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.