blob: affa8b3d21164bcae208f5ef5e7f3285dfd022ab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
/* ISC license. */
#include <errno.h>
#include <time.h>
#include <pthread.h>
#include <skalibs/sysdeps.h>
#include <skalibs/tai.h>
#include <skalibs/pthread.h>
int pthread_mutex_tailock (pthread_mutex_t *mtx, tain const *deadline, tain *stamp)
{
struct timespec ts ;
tain tto ;
tain_sub(&tto, deadline, stamp) ;
if (!timespec_from_tain_relative(&ts, &tto)) return errno ;
#ifdef SKALIBS_HASPTHREADMUTEXCLOCKLOCK
if (&tain_now != &tain_wallclock_read)
return pthread_mutex_clocklock(mtx, CLOCK_MONOTONIC, &ts) ;
else
#else
return pthread_mutex_timedlock(mtx, &ts) ;
#endif
}
|