On Fri, 4 May 2012 23:17:21 +0100, Pete Batard said:

>> 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').
>
>Wouldn't that mean that OS-X would have different logging from other
>platforms?

Seems it already does, no?  Not all platforms have mach threads after all.

pthread_getname_np() is available on many UNIXy platforms, but not always with 
the same parameters.  Not ideal I agree.  Just pointing out options.

>> libusbx is already calling pthread_setname_np() for the thread it creates.
>
>But only for OS X I assume...

I believe only on OS X does libusb ever create threads at all...

>Do you anticipate issues from using mach threads?

Not per say.  As a general rule, I find it best to use the highest level APIs 
that are available.  mach is particular to OS X, less portable, less documented 
(ex: mach_thread_self has no man page, pthread_self does), etc.

Of note: the Xcode debugger GUI shows two thread identifiers:
 - a number (dunno where it's from, maybe mach_thread_self even).  I could try 
to find this out...
 - the pthread_getname_np name

Mac developers may appreciate that the same identifiers be shown by libusb.

See:
<http://developer.apple.com/library/mac/documentation/IDEs/Conceptual/Xcode4TransitionGuide/Debugging/Debugging.html#//apple_ref/doc/uid/TP40009984-CH3-SW39>

-- 
____________________________________________________________
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

Reply via email to