On Thu, 3 May 2012 23:32:22 +0100, Pete Batard said: >>> +#elif defined(__APPLE__) >>> + ret = mach_thread_self(); >>> + mach_port_deallocate(mach_task_self(), ret); >> >> Perhaps I missed an earlier discussion, but why drop to the mach >level? Wouldn't pthread_self() be more portable? > >The problem with pthread_self() is it returns a pthread_t, which, from >what I could see, is not guaranteed to be an integer (can be an opaque >struct [1]). Since we want to display it, we need an integer value.
Do you necessarily need an integer to display? You could also print the address of the pthread_t struct or use pthread_getname_np() to get a string name of the thread (though that's only available on 10.6 and later, and the 'np' means 'not portable'). libusbx is already calling pthread_setname_np() for the thread it creates. It's very rare on Mac OS to drop to mach threads, I'm not sure the mach_thread_self number is particularly meaningful to anyone doing debugging. -- ____________________________________________________________ Sean McBride, B. Eng s...@rogue-research.com Rogue Research www.rogue-research.com Mac Software Developer Montréal, Québec, Canada ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ libusbx-devel mailing list libusbx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libusbx-devel