Nadav writes:
"It appears that the new <mutex> C++ header file (included by include/osv/mutex.h,
I don't remember why) needs pthread_mutex_clocklock() to be defined in our pthread header files.
Let's just implement this function. Seeing that our pthread_mutex_timedlock() is already
a stub (nobody ever complained...), pthread_mutex_clocklock() can also be a stub.
I think this will be easy, and hopefully work."
Signed-off-by: Waldemar Kozaczuk <
jwkoz...@gmail.com>
---
include/api/pthread.h | 2 ++
libc/pthread.cc | 16 ++++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/include/api/pthread.h b/include/api/pthread.h
index 1fca154b..027a4bb1 100644
--- a/include/api/pthread.h
+++ b/include/api/pthread.h
@@ -102,6 +102,7 @@ int pthread_mutex_lock(pthread_mutex_t *);
int pthread_mutex_unlock(pthread_mutex_t *);
int pthread_mutex_trylock(pthread_mutex_t *);
int pthread_mutex_timedlock(pthread_mutex_t *__restrict, const struct timespec *__restrict);
+int pthread_mutex_clocklock(pthread_mutex_t *__restrict, clockid_t clock, const struct timespec *__restrict);
int pthread_mutex_destroy(pthread_mutex_t *);
int pthread_mutex_consistent(pthread_mutex_t *);
@@ -112,6 +113,7 @@ int pthread_cond_init(pthread_cond_t *__restrict, const pthread_condattr_t *__re
int pthread_cond_destroy(pthread_cond_t *);
int pthread_cond_wait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict);
int pthread_cond_timedwait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict, const struct timespec *__restrict);
+int pthread_cond_clockwait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict, clockid_t clock, const struct timespec *__restrict);
int pthread_cond_broadcast(pthread_cond_t *);
int pthread_cond_signal(pthread_cond_t *);
diff --git a/libc/pthread.cc b/libc/pthread.cc
index 8c976bf6..2f0afb7f 100644
--- a/libc/pthread.cc
+++ b/libc/pthread.cc
@@ -443,6 +443,13 @@ int pthread_mutex_timedlock(pthread_mutex_t *m,
return EINVAL;
}
+int pthread_mutex_clocklock(pthread_mutex_t *m,
+ clockid_t clock,
+ const struct timespec *abs_timeout)
+{
+ WARN_STUBBED();
+ return EINVAL;
+}
int pthread_mutex_unlock(pthread_mutex_t *m)
{
@@ -616,6 +623,15 @@ int pthread_cond_timedwait(pthread_cond_t *__restrict cond,
return from_libc(cond)->wait(from_libc(mutex), &tmr);
}
+int pthread_cond_clockwait(pthread_cond_t *__restrict cond,
+ pthread_mutex_t *__restrict mutex,
+ clockid_t clock_id,
+ const struct timespec* __restrict ts)
+{
+ WARN_STUBBED();
+ return EINVAL;
+}
+
int pthread_attr_init(pthread_attr_t *attr)
{
new (attr) thread_attr;
--
2.26.2