> calling CrashLogThreadID(pthread_t) might be too costly for every
> call to my custom debugLog(...)

I've done it that way when debugging threads. It doesn't take long; none of
the calls take very long, especially when compared to what goes on when
writing to a log anyway.

Do note though that writing to streams has to lock something underneath so
that writes from multiple threads don't intermingle, which means that adding
more logging can sometimes disguise your threading bugs by adding
synchronization points near where your problems are. The joys of threads!

Also note that when running on the debugger, the locking is not right for
some reason, so output from multiple threads can get intermingled. But this
doesn't happen in production builds. I don't know whether it's a gdb
interaction or some debug library that causes it... BTW, I'm talking here
about stdout & cout--I don't know if NSLog has the same issue because I
don't use it very much.

-- 
Scott Ribe
scott_r...@killerbytes.com
http://www.killerbytes.com/
(303) 722-0567 voice


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to