aboutsummaryrefslogtreecommitdiff
path: root/loader/loader_platform.h
diff options
context:
space:
mode:
authorMike Stroyan <mike@LunarG.com>2015-05-15 08:50:57 -0600
committerMike Stroyan <mike@LunarG.com>2015-05-15 15:38:23 -0600
commitcbf8fc1ce9911fa700009a1c7cfaa61e3eddbe8e (patch)
tree4a3e17b85dd61e944a3e2d787b7a334255f54ca7 /loader/loader_platform.h
parent9fde28dffb7e642dfa282e5bb8df44d9f4c2444a (diff)
downloadusermoji-cbf8fc1ce9911fa700009a1c7cfaa61e3eddbe8e.tar.xz
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.
Diffstat (limited to 'loader/loader_platform.h')
-rw-r--r--loader/loader_platform.h13
1 files changed, 13 insertions, 0 deletions
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__)