6 int cond_init_pshared(pthread_cond_t *cond)
8 pthread_condattr_t cattr;
11 ret = pthread_condattr_init(&cattr);
13 log_err("pthread_condattr_init: %s\n", strerror(ret));
18 ret = pthread_condattr_setpshared(&cattr, PTHREAD_PROCESS_SHARED);
20 log_err("pthread_condattr_setpshared: %s\n", strerror(ret));
25 #ifdef CONFIG_PTHREAD_CONDATTR_SETCLOCK
26 ret = pthread_condattr_setclock(&cattr, CLOCK_MONOTONIC);
28 log_err("pthread_condattr_setclock: %s\n", strerror(ret));
33 ret = pthread_cond_init(cond, &cattr);
35 log_err("pthread_cond_init: %s\n", strerror(ret));
42 int mutex_init_pshared(pthread_mutex_t *mutex)
44 pthread_mutexattr_t mattr;
47 ret = pthread_mutexattr_init(&mattr);
49 log_err("pthread_mutexattr_init: %s\n", strerror(ret));
54 * Not all platforms support process shared mutexes (FreeBSD)
57 ret = pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED);
59 log_err("pthread_mutexattr_setpshared: %s\n", strerror(ret));
63 ret = pthread_mutex_init(mutex, &mattr);
65 log_err("pthread_mutex_init: %s\n", strerror(ret));
72 int mutex_cond_init_pshared(pthread_mutex_t *mutex, pthread_cond_t *cond)
76 ret = mutex_init_pshared(mutex);
80 ret = cond_init_pshared(cond);