summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorbje <bje>1998-10-04 21:04:28 +0000
committerbje <bje>1998-10-04 21:04:28 +0000
commitd0aed2a7bfdad688de32a7c4d894590502e6bac4 (patch)
treef101dc214318f924a902a1e81986c6206415cc1a /misc.c
parent11b839f08794de0d090811580a09aa6db5b21f2c (diff)
1998-10-05 Ben Elliston <bje@cygnus.com>
* misc.c (pthread_once): Use the POSIX mutex primitives, not Win32. Remove irrelevant FIXME comment. * pthread.h (PTHREAD_ONCE_INIT): Define. * tests/once1.c: New file; test for pthread_once(). Passes.
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/misc.c b/misc.c
index eebebae..d39af50 100644
--- a/misc.c
+++ b/misc.c
@@ -22,17 +22,13 @@ pthread_once(pthread_once_t *once_control,
return EINVAL;
}
- /* FIXME: we are assuming that the `cs' object is initialised at DLL
- load time. Likewise, the object should be destroyed when (if)
- the DLL is unloaded. */
-
/* An atomic test-and-set of the "once" flag. */
- EnterCriticalSection(&once_control->lock);
+ pthread_mutex_lock(&once_control->lock);
if (once_control->flag == 0)
{
flag = once_control->flag = 1;
}
- LeaveCriticalSection(&once_control->lock);
+ pthread_mutex_unlock(&once_control->lock);
if (flag)
{