1 2 3 4 5 6 7 8 9 10 11
/* ISC license. */ #include <time.h> #include <pthread.h> int main (void) { pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER ; struct timespec ts = { .tv_sec = 0, .tv_nsec = 1 } ; return pthread_mutex_timedlock(&mtx, &ts) ; }