The call to pthread_setname_np() makes it easy to identify the
background thread in the Xcode debugger and in crash reports.
struct libusb_context *ctx = (struct libusb_context *)arg0;
CFRunLoopRef runloop;
+ /* Set this thread's name, so it can be seen in the debugger
+ and crash reports. */
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
+ pthread_setname_np ("org.libusb.device-detach");
+#endif
+
/* Tell the Objective-C garbage collector about this thread.
This is required because, unlike NSThreads, pthreads are
not automatically registered. Although we don't use