aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libposixplz/pthread_mutex_tailock.c (renamed from src/libstddjb/pthread_mutex_tailock.c)13
-rw-r--r--src/sysdeps/trypthreadmutexclocklock.c4
-rw-r--r--src/sysdeps/trypthreadmutextimedlock.c11
3 files changed, 26 insertions, 2 deletions
diff --git a/src/libstddjb/pthread_mutex_tailock.c b/src/libposixplz/pthread_mutex_tailock.c
index 8f8fbf3..736921c 100644
--- a/src/libstddjb/pthread_mutex_tailock.c
+++ b/src/libposixplz/pthread_mutex_tailock.c
@@ -8,6 +8,8 @@
#include <skalibs/tai.h>
#include <skalibs/pthread.h>
+#ifdef SKALIBS_HASPTHREADMUTEXTIMEDLOCK
+
int pthread_mutex_tailock (pthread_mutex_t *mtx, tain const *deadline, tain *stamp)
{
int e ;
@@ -26,3 +28,14 @@ int pthread_mutex_tailock (pthread_mutex_t *mtx, tain const *deadline, tain *sta
tain_now(stamp) ;
return e ;
}
+
+#else
+
+int pthread_mutex_tailock (pthread_mutex_t *mtx, tain const *deadline, tain *stamp)
+{
+ (void)deadline ;
+ (void)stamp ;
+ return pthread_mutex_lock(mtx) ;
+}
+
+#endif
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) ;
+}