summaryrefslogtreecommitdiff
path: root/pthread_mutex_init.c
diff options
context:
space:
mode:
authorrpj <rpj>2004-10-16 02:34:44 +0000
committerrpj <rpj>2004-10-16 02:34:44 +0000
commit45b1b8cb2a6588f9316f780d8cefe11c181a9a17 (patch)
tree24753e298d9933d48d764177baf183ef97f04156 /pthread_mutex_init.c
parent9da8fdcb33373b4b2e1de2a8b7af3ed4b5811245 (diff)
Mutex speedups cont'd
Diffstat (limited to 'pthread_mutex_init.c')
-rw-r--r--pthread_mutex_init.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/pthread_mutex_init.c b/pthread_mutex_init.c
index fdb6017..0709690 100644
--- a/pthread_mutex_init.c
+++ b/pthread_mutex_init.c
@@ -80,18 +80,22 @@ pthread_mutex_init (pthread_mutex_t * mutex, const pthread_mutexattr_t * attr)
}
else
{
- mx->lock_idx = -1;
+ mx->lock_idx = 0;
mx->recursive_count = 0;
mx->kind = (attr == NULL || *attr == NULL
? PTHREAD_MUTEX_DEFAULT : (*attr)->kind);
mx->ownerThread = NULL;
- if (0 != sem_init (&mx->wait_sema, 0, 0))
- {
- result = EAGAIN;
- free (mx);
- mx = NULL;
- }
+ mx->event = CreateEvent (NULL, PTW32_FALSE, /* manual reset = No */
+ PTW32_FALSE, /* initial state = not signaled */
+ NULL); /* event name */
+
+ if (0 == mx->event)
+ {
+ result = ENOSPC;
+ free (mx);
+ mx = NULL;
+ }
}
*mutex = mx;