This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs. |
Join a thread, with a time limit
#include <pthread.h> int pthread_timedjoin( pthread_t thread, void** value_ptr, const struct timespec* abstime );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The pthread_timedjoin() function is similar to pthread_join(), except that an error of ETIMEDOUT is returned if the join doesn't occur before the absolute time specified by abstime passes (i.e. the system time is greater than or equal to abstime):
If you are not too long, I will wait here for you all my life.
-- Oscar Wilde, The Importance of Being Earnest
The pthread_timedjoin() function blocks the calling thread until the target thread thread terminates, unless thread has already terminated. If value_ptr is non-NULL and pthread_timedjoin() returns successfully, then the value passed to pthread_exit() by the target thread is placed in value_ptr. If the target thread has been canceled then value_ptr is set to PTHREAD_CANCELED.
The target thread must be joinable. Multiple pthread_join(), pthread_timedjoin(), ThreadJoin(), and ThreadJoin_r() calls on the same target thread aren't allowed. When pthread_timedjoin() returns successfully, the target thread has been terminated.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
pthread_create(), pthread_detach(), pthread_exit(), pthread_join(), ThreadJoin(), ThreadJoin_r(), timespec