有系统调用:pthread_timedjoin_np
The pthread_timedjoin_np() function performs a join-with-timeout. If thread has not yet terminated, then the call blocks until a maximum time, specified in
abstime. If the timeout expires before thread terminates, the call returns an error. The abstime argument is a structure of the following form, specifying
an absolute time measured since the Epoch (see time(2)):
struct timespec {
time_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */
};