How to know if a pthread died?

If(phtread_kill(the_thread, 0) == 0) { /* still running */ } See: pthread_kill.

Will this kill the thread first, or attempt to do so. Or will it just check it? Thanks – Helium3 Apr 23 at 13:52 From above link: "As in kill(), if sig is zero, error checking shall be performed but no signal shall actually be sent".

Which means no, it will not kill the thread. It will just tell you whether it's still there. – Damon Apr 23 at 13:53 Thanks A LOT for this!

;) – Helium3 Apr 23 at 13:54 @Damon: Btw, is this 'the_thread' the name of the thread, the actual thread? Or is it the return value of the thread? E.g.

GpsNavigationThreadResult = pthread_create(&gpsNavigationThread, NULL, setupgpsnavigation, (void*) message3); – Helium3 Apr 23 at 15:57 It is the pthread_t that you got from pthread_create (i.e. The thread id). – Damon Apr 23 at 16:04.

If you don't need to write a portable application and can use GNU extensions, you can use pthread_tryjoin_np. I believe there isn't another way to do it, except for setting up communication between two threads (e.g. Using a global mutex which is hold by a thread as long as it is alive).

How to know if a pthread died - Stack Overflow.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions