diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2026-03-18 21:17:10 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska-skaware@skarnet.org> | 2026-03-18 21:17:10 +0000 |
| commit | 6e6eb242188e8312a6a8a78e6be0d11cd1036610 (patch) | |
| tree | 02cb09a553f32bb5fbb671528ab900a1636c7bce /src/sysdeps | |
| parent | ebce1a511a60f3b4a9785c3962eaa381206c914f (diff) | |
| download | skalibs-6e6eb242188e8312a6a8a78e6be0d11cd1036610.tar.gz | |
MacOS doesn't have pthread_mutex_timedlock -_-
Diffstat (limited to 'src/sysdeps')
| -rw-r--r-- | src/sysdeps/trypthreadmutexclocklock.c | 4 | ||||
| -rw-r--r-- | src/sysdeps/trypthreadmutextimedlock.c | 11 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/sysdeps/trypthreadmutexclocklock.c b/src/sysdeps/trypthreadmutexclocklock.c index b102db2..4a84091 100644 --- a/src/sysdeps/trypthreadmutexclocklock.c +++ b/src/sysdeps/trypthreadmutexclocklock.c @@ -5,7 +5,7 @@ int main (void) { - pthread_mutex_t mtx = PTHREAD_MUTEX_INIT ; - strict timespec ts = { .tv_sec = 0, .tv_nsec = 1 } ; + pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER ; + struct timespec ts = { .tv_sec = 0, .tv_nsec = 1 } ; return pthread_mutex_clocklock(&mtx, CLOCK_MONOTONIC, &ts) ; } diff --git a/src/sysdeps/trypthreadmutextimedlock.c b/src/sysdeps/trypthreadmutextimedlock.c new file mode 100644 index 0000000..f76f198 --- /dev/null +++ b/src/sysdeps/trypthreadmutextimedlock.c @@ -0,0 +1,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) ; +} |
