19 #error "OS not supported" 52 return pthread_mutex_init(&om->
mutex, NULL);
61 pthread_mutex_lock(&om->
mutex);
70 pthread_mutex_unlock(&om->
mutex);
77 os_mutex_destroy(
struct os_mutex *om)
79 pthread_mutex_destroy(&om->
mutex);
101 typedef void *(*os_run_func)(
void *);
118 return pthread_create(&ost->
thread, NULL, func, ptr);
129 pthread_join(ost->
thread, &retval);
166 int ret = pthread_mutex_init(&oth->
mutex, NULL);
171 ret = pthread_cond_init(&oth->
cond, NULL);
173 pthread_mutex_destroy(&oth->
mutex);
188 pthread_mutex_lock(&oth->
mutex);
191 pthread_mutex_unlock(&oth->
mutex);
195 int ret = pthread_create(&oth->
thread, NULL, func, ptr);
197 pthread_mutex_unlock(&oth->
mutex);
203 pthread_mutex_unlock(&oth->
mutex);
217 pthread_mutex_lock(&oth->
mutex);
220 pthread_mutex_unlock(&oth->
mutex);
228 pthread_cond_signal(&oth->
cond);
231 pthread_mutex_unlock(&oth->
mutex);
234 pthread_join(oth->
thread, &retval);
246 os_thread_helper_stop(oth);
249 pthread_mutex_destroy(&oth->
mutex);
250 pthread_cond_destroy(&oth->
cond);
259 pthread_mutex_lock(&oth->
mutex);
268 pthread_mutex_unlock(&oth->
mutex);
290 pthread_cond_wait(&oth->
cond, &oth->
mutex);
301 pthread_cond_signal(&oth->
cond);
Auto detect OS and certain features.
pthread_t thread
Definition: os_threading.h:95
bool running
Definition: os_threading.h:157
pthread_t thread
Definition: os_threading.h:153
pthread_cond_t cond
Definition: os_threading.h:155
All in one helper that handles locking, waiting for change and starting a thread. ...
Definition: os_threading.h:151
pthread_mutex_t mutex
Definition: os_threading.h:154
pthread_mutex_t mutex
Definition: os_threading.h:43
#define U_ZERO(PTR)
Zeroes the correct amount of memory based on the type pointed-to by the argument. ...
Definition: u_misc.h:61
A wrapper around a native mutex.
Definition: os_threading.h:41
A wrapper around a native mutex.
Definition: os_threading.h:93
void *(* os_run_func)(void *)
Run function.
Definition: os_threading.h:101