diff options
Diffstat (limited to 'src/libstddjb')
| -rw-r--r-- | src/libstddjb/pthread_mutex_tailock.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libstddjb/pthread_mutex_tailock.c b/src/libstddjb/pthread_mutex_tailock.c index affa8b3..8f8fbf3 100644 --- a/src/libstddjb/pthread_mutex_tailock.c +++ b/src/libstddjb/pthread_mutex_tailock.c @@ -10,15 +10,19 @@ int pthread_mutex_tailock (pthread_mutex_t *mtx, tain const *deadline, tain *stamp) { + int e ; struct timespec ts ; tain tto ; + if (!stamp) return pthread_mutex_lock(mtx) ; 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) ; + e = pthread_mutex_clocklock(mtx, CLOCK_MONOTONIC, &ts) ; else #else - return pthread_mutex_timedlock(mtx, &ts) ; + e = pthread_mutex_timedlock(mtx, &ts) ; #endif + tain_now(stamp) ; + return e ; } |
