first argument of pthread_create is pthread_t (which is typedef'ed to long), which I understand is thread ID.
Does it set this value to zero when thread finishes execution? I would like to use it to check if the thread is running
first argument of pthread_create is pthread_t (which is typedef'ed to long), which I understand is thread ID.
Does it set this value to zero when thread finishes execution? I would like to use it to check if the thread is running
No, the pthread_t
isn't changed by the pthread library once it's initialized. Pass the pthread_t
object to pthread_join()
to wait until the thread is finished. If you want to determine without blocking, you can have the thread cooperate by setting an indicator for it's state in some shared object.