Re: Thread ID in crash log
Re: Thread ID in crash log
- Subject: Re: Thread ID in crash log
- From: radj <email@hidden>
- Date: Thu, 18 Dec 2008 09:37:49 +0800
> The crash log's thread ID is not fixed. If you run ten helper threads and
> nine of them exit before you crash, the surviving helper thread will always
> be "Thread 1" in the crash log. Any scheme that tries to predict the crash
> log's thread ID will be unreliable - a thread could always be created or
> destroyed between the time you fetch the thread ID and the time you crash.
>
> Having said that, it is possible to get the number that the crash report
> would contain were the program to crash right now. The number happens to be
> the thread's index in the array returned by task_threads(). This may change
> in the future, and it's not reliable as described above, but it may be
> helpful for debugging in the meantime.
>
I see. I'm not trying to be ungrateful (because I really am, thanks for the
code), but calling CrashLogThreadID(pthread_t) might be too costly for every
call to my custom debugLog(...) because there are alot all over the code
(not the best practice, me thinks). But thanks to your intro to
task_threads(), I can follow the idea and try my own array of threads. This
gives me something to start on! Appreciate it. =)
- radj
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden