summaryrefslogtreecommitdiff
path: root/ptw32_reuse.c
diff options
context:
space:
mode:
authorrpj <rpj>2011-03-10 13:40:16 +0000
committerrpj <rpj>2011-03-10 13:40:16 +0000
commit6e3ac5c605d5062279178b3ea0b853d0e9cf7cc9 (patch)
treed9262f28ef4083dfeefbd31bc9b163cf67e102e1 /ptw32_reuse.c
parenteb28d5aa00690b67cc27e4bd93d2c4c251987c85 (diff)
Replace global Critical Sections with MCS Queue locks
Diffstat (limited to 'ptw32_reuse.c')
-rw-r--r--ptw32_reuse.c10
1 files changed, 6 insertions, 4 deletions
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);
}