#include <threads.h>
+#include <pthread.h>
-int __private_cond_signal(cnd_t *, int);
+int __private_cond_signal(pthread_cond_t *, int);
int cnd_broadcast(cnd_t *c)
{
/* This internal function never fails, and always returns zero,
* which matches the value thrd_success is defined with. */
- return __private_cond_signal(c, -1);
+ return __private_cond_signal((pthread_cond_t *)c, -1);
}
#include <threads.h>
+#include <pthread.h>
-int __private_cond_signal(cnd_t *, int);
+int __private_cond_signal(pthread_cond_t *, int);
int cnd_signal(cnd_t *c)
{
/* This internal function never fails, and always returns zero,
* which matches the value thrd_success is defined with. */
- return __private_cond_signal(c, 1);
+ return __private_cond_signal((pthread_cond_t *)c, 1);
}
#include <threads.h>
+#include <pthread.h>
#include <errno.h>
-int __pthread_cond_timedwait(cnd_t *restrict, mtx_t *restrict, const struct timespec *restrict);
+int __pthread_cond_timedwait(pthread_cond_t *restrict, pthread_mutex_t *restrict, const struct timespec *restrict);
int cnd_timedwait(cnd_t *restrict c, mtx_t *restrict m, const struct timespec *restrict ts)
{
- int ret = __pthread_cond_timedwait(c, m, ts);
+ int ret = __pthread_cond_timedwait((pthread_cond_t *)c, (pthread_mutex_t *)m, ts);
switch (ret) {
/* May also return EINVAL or EPERM. */
default: return thrd_error;
#include <threads.h>
+#include <pthread.h>
#include <errno.h>
-int __pthread_mutex_timedlock(mtx_t *restrict, const struct timespec *restrict);
+int __pthread_mutex_timedlock(pthread_mutex_t *restrict, const struct timespec *restrict);
int mtx_timedlock(mtx_t *restrict m, const struct timespec *restrict ts)
{
- int ret = __pthread_mutex_timedlock(m, ts);
+ int ret = __pthread_mutex_timedlock((pthread_mutex_t *)m, ts);
switch (ret) {
default: return thrd_error;
case 0: return thrd_success;
#include "pthread_impl.h"
#include <threads.h>
-int __pthread_mutex_trylock(mtx_t *);
+int __pthread_mutex_trylock(pthread_mutex_t *);
int mtx_trylock(mtx_t *m)
{
if (m->_m_type == PTHREAD_MUTEX_NORMAL)
return (a_cas(&m->_m_lock, 0, EBUSY) & EBUSY) ? thrd_busy : thrd_success;
- int ret = __pthread_mutex_trylock(m);
+ int ret = __pthread_mutex_trylock((pthread_mutex_t *)m);
switch (ret) {
default: return thrd_error;
case 0: return thrd_success;
#include <threads.h>
+#include <pthread.h>
-int __pthread_mutex_unlock(mtx_t *);
+int __pthread_mutex_unlock(pthread_mutex_t *);
int mtx_unlock(mtx_t *mtx)
{
/* The only cases where pthread_mutex_unlock can return an
* error are undefined behavior for C11 mtx_unlock, so we can
* assume it does not return an error and simply tail call. */
- return __pthread_mutex_unlock(mtx);
+ return __pthread_mutex_unlock((pthread_mutex_t *)mtx);
}