I am trying to handle all the possible return values of pthread_timedjoin_np()
, but I did not quite understand, when does it return EBUSY
?
If the thread returns within the given time pthread_timedjoin_np()
always returns zero, while if time has passed I get ETIMEDOUT
. What do I have to do to trigger EBUSY
?
I did not quite understand, when does it return EBUSY?
Never.
The man page that you are reading is for both pthread_tryjoin_np
and pthread_timedjoin_np
. pthread_tryjoin_np
will return with EBUSY
when "thread had not yet terminated at the time of the call".
These functions can fail with the same errors as pthread_join(3).
pthread_tryjoin_np() can in addition fail with the following error:EBUSY thread had not yet terminated at the time of the call.
pthread_timedjoin_np() can in addition fail with the following errors:
EINVAL abstime value is invalid (tv_sec is less than 0 or tv_nsec is greater than 1e9).
ETIMEDOUT The call timed out before thread terminated.