From: Waldemar Kozaczuk <[email protected]>
Committer: Nadav Har'El <[email protected]>
Branch: master

pthreads: add stubs for new *clockwait/*clocklock functions to fix gcc 10 errors

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 <[email protected]>
Message-Id: <[email protected]>

---
diff --git a/include/api/pthread.h b/include/api/pthread.h
--- 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
--- 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;

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/0000000000007ed03105a4ee7095%40google.com.

Reply via email to