From 6e3ac5c605d5062279178b3ea0b853d0e9cf7cc9 Mon Sep 17 00:00:00 2001 From: rpj Date: Thu, 10 Mar 2011 13:40:16 +0000 Subject: Replace global Critical Sections with MCS Queue locks --- ptw32_reuse.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'ptw32_reuse.c') diff --git a/ptw32_reuse.c b/ptw32_reuse.c index 0e86984..79e4dee 100644 --- a/ptw32_reuse.c +++ b/ptw32_reuse.c @@ -76,8 +76,9 @@ pthread_t ptw32_threadReusePop (void) { pthread_t t = {NULL, 0}; + ptw32_mcs_local_node_t node; - EnterCriticalSection (&ptw32_thread_reuse_lock); + ptw32_mcs_lock_acquire(&ptw32_thread_reuse_lock, &node); if (PTW32_THREAD_REUSE_EMPTY != ptw32_threadReuseTop) { @@ -97,7 +98,7 @@ ptw32_threadReusePop (void) t = tp->ptHandle; } - LeaveCriticalSection (&ptw32_thread_reuse_lock); + ptw32_mcs_lock_release(&node); return t; @@ -114,8 +115,9 @@ ptw32_threadReusePush (pthread_t thread) { ptw32_thread_t * tp = (ptw32_thread_t *) thread.p; pthread_t t; + ptw32_mcs_local_node_t node; - EnterCriticalSection (&ptw32_thread_reuse_lock); + ptw32_mcs_lock_acquire(&ptw32_thread_reuse_lock, &node); t = tp->ptHandle; memset(tp, 0, sizeof(ptw32_thread_t)); @@ -143,5 +145,5 @@ ptw32_threadReusePush (pthread_t thread) ptw32_threadReuseBottom = tp; - LeaveCriticalSection (&ptw32_thread_reuse_lock); + ptw32_mcs_lock_release(&node); } -- cgit v1.2.3