Subj : Re: pthread_create and memory To : comp.programming.threads From : Giancarlo Niccolai Date : Mon Mar 14 2005 01:31 am Bluejack wrote: > On Fri, 11 Mar 2005 12:55:31 GMT, Gio67 wrote: > >> I have an other request: do you know any api of kernel to know the >> status of >> the threads ?? > > Depending on what you mean by "status" the api you are probably looking > for is pthread_join(): > > http://www.opengroup.org/onlinepubs/007908799/xsh/pthread_join.html If you are not meaning "the end of the thread" for the "status", then the idea is that the status of a thread is undefined if seen from another thread. Making the status defined is a complex operation, and it requires: 1 - the thread whose status must be know must stop and signal the fact that it is in a certain status 2 - the thread(s) willing to know about the target thread status must tell the that thread that they are done, and the first thread is then free to go again. I.e. if you wish to know if a thread is alive or is already gone ... you probably can't, but you can get a decent approximation by having a thread joining another one, and signaling/setting a value when the guarded thread ends. You won't know EXACTLY when the thread is alive, but if you just need a good approximation, that is often enough. Bests, Giancarlo Niccolai. .