Multithreaded Programming Guide

pthread_cond_reltimedwait_np Syntax

int pthread_cond_reltimedwait_np(pthread_cond_t *cv, 
           pthread_mutex_t *mp, 
          const struct timespec *reltime);
#include <pthread.h>
#include <time.h> 
pthread_cond_t cv; 
pthread_mutex_t mp; 
timestruct_t reltime; 
int ret; 

/* wait on condition variable */ 
ret = pthread_cond_reltimedwait_np(&cv, &mp, &reltime); 

pthread_cond_reltimedwait_np() always returns with the mutex locked and owned by the calling thread, even when pthread_cond_reltimedwait_np() is returning an error. The pthread_cond_reltimedwait_np() function blocks until the condition is signaled or until the time interval specified by the last argument has elapsed.

Note –

pthread_cond_reltimedwait_np() is also a cancellation point.