about summary refs log tree commit diff
path: root/src/rt/rust_sched_driver.cpp
diff options
context:
space:
mode:
authorEric Holk <eric.holk@gmail.com>2012-08-02 14:42:12 -0700
committerEric Holk <eric.holk@gmail.com>2012-08-02 19:26:33 -0700
commitce6d6511c7fb7f82d2890de578ef9bb28e410281 (patch)
treefa55f7b33a251dd54961c42487c1b3fa665f7823 /src/rt/rust_sched_driver.cpp
parentf76a46242b6a34ac09643ddf4050be9d1ad11573 (diff)
downloadrust-ce6d6511c7fb7f82d2890de578ef9bb28e410281.tar.gz
rust-ce6d6511c7fb7f82d2890de578ef9bb28e410281.zip
Set thread name on Mac to make gdb thread info more useful.
Diffstat (limited to 'src/rt/rust_sched_driver.cpp')
-rw-r--r--src/rt/rust_sched_driver.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/rt/rust_sched_driver.cpp b/src/rt/rust_sched_driver.cpp
index 0da9d580dc3..4876c279644 100644
--- a/src/rt/rust_sched_driver.cpp
+++ b/src/rt/rust_sched_driver.cpp
@@ -22,6 +22,18 @@ void
 rust_sched_driver::start_main_loop() {
     assert(sched_loop != NULL);
 
+#ifdef __APPLE__
+    {
+        char buf[64];
+        snprintf(buf, sizeof(buf), "scheduler loop %d", sched_loop->get_id());
+        // pthread_setname_np seems to have a different signature and
+        // different behavior on different platforms. Thus, this is
+        // only for Mac at the moment. There are equivalent versions
+        // for Linux that we can add if needed.
+        pthread_setname_np(buf);
+    }
+#endif
+
     rust_sched_loop_state state = sched_loop_state_keep_going;
     while (state != sched_loop_state_exit) {
         DLOG(sched_loop, dom, "pumping scheduler");