[compiler-rt] Reland "SetThreadName implementation for Fuchsia" (#105179)
GitOrigin-RevId: f47966b1de459a095b01ac2f9fa975076b609c06
diff --git a/FuzzerUtilFuchsia.cpp b/FuzzerUtilFuchsia.cpp
index fe79e19..735d155 100644
--- a/FuzzerUtilFuchsia.cpp
+++ b/FuzzerUtilFuchsia.cpp
@@ -607,7 +607,11 @@
}
void SetThreadName(std::thread &thread, const std::string &name) {
- // TODO ?
+ if (zx_status_t s = zx_object_set_property(
+ thread.native_handle(), ZX_PROP_NAME, name.data(), name.size());
+ s != ZX_OK)
+ Printf("SetThreadName for name %s failed: %s", name.c_str(),
+ zx_status_get_string(s));
}
} // namespace fuzzer