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));
24 ret = pthread_cond_init(cond, &cattr);
26 log_err("pthread_cond_init: %s\n", strerror(ret));
33 int mutex_init_pshared(pthread_mutex_t *mutex)
35 pthread_mutexattr_t mattr;
38 ret = pthread_mutexattr_init(&mattr);
40 log_err("pthread_mutexattr_init: %s\n", strerror(ret));
45 * Not all platforms support process shared mutexes (FreeBSD)
48 ret = pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED);
50 log_err("pthread_mutexattr_setpshared: %s\n", strerror(ret));
54 ret = pthread_mutex_init(mutex, &mattr);
56 log_err("pthread_mutex_init: %s\n", strerror(ret));
63 int mutex_cond_init_pshared(pthread_mutex_t *mutex, pthread_cond_t *cond)
67 ret = mutex_init_pshared(mutex);
71 ret = cond_init_pshared(cond);