Originally Posted by
tezcatlipooca
I sense that it would be rather risky for a thread to mark itself free and then kill itself because it may blocks after marking itself (assuming that scheduler acts randomly) and then main thread would suppose that a running thread has exited
On the other hand, i find it more reliable for the parent process to kill the thread (using pthread_cancel right?) after the thread has marked itself as free.
But what if parent thread tries to kill a thread which has already exited?
PS:I guess i can use a dynamic structure to store thread ids instead of static one; I just sense that the second one will be more efficient.