From cbf8fc1ce9911fa700009a1c7cfaa61e3eddbe8e Mon Sep 17 00:00:00 2001 From: Mike Stroyan Date: Fri, 15 May 2015 08:50:57 -0600 Subject: layers: Make threading layer provide thread-safety Add mutual exclusion behavior to threading layer after reporting collisions. This will allow applications to continue beyond first threading error. It can't help reentrant calls. --- loader/loader_platform.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'loader/loader_platform.h') diff --git a/loader/loader_platform.h b/loader/loader_platform.h index 60460bfb..9f7b47d1 100644 --- a/loader/loader_platform.h +++ b/loader/loader_platform.h @@ -129,6 +129,19 @@ static inline void loader_platform_thread_delete_mutex(loader_platform_thread_mu { pthread_mutex_destroy(pMutex); } +typedef pthread_cond_t loader_platform_thread_cond; +static inline void loader_platform_thread_init_cond(loader_platform_thread_cond* pCond) +{ + pthread_cond_init(pCond, NULL); +} +static inline void loader_platform_thread_cond_wait(loader_platform_thread_cond* pCond, loader_platform_thread_mutex* pMutex) +{ + pthread_cond_wait(pCond, pMutex); +} +static inline void loader_platform_thread_cond_broadcast(loader_platform_thread_cond* pCond) +{ + pthread_cond_broadcast(pCond); +} #elif defined(_WIN32) // defined(__linux__) -- cgit v1.2.3