From 45b1b8cb2a6588f9316f780d8cefe11c181a9a17 Mon Sep 17 00:00:00 2001 From: rpj Date: Sat, 16 Oct 2004 02:34:44 +0000 Subject: Mutex speedups cont'd --- pthread_mutex_init.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'pthread_mutex_init.c') 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; -- cgit v1.2.3