summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrpj <rpj>2005-06-03 14:49:22 +0000
committerrpj <rpj>2005-06-03 14:49:22 +0000
commit78ecbc3c3e1a08a9e8fd35983dc0b22c8e2d116e (patch)
treee18be25bc17b255feac77ae2ff0e26571b3b8674
parent15f1b0bc1f4feeca60ca1dda769928822d6c032a (diff)
-rw-r--r--pthread.h2
-rw-r--r--pthread_once.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/pthread.h b/pthread.h
index f901459..ac3dab0 100644
--- a/pthread.h
+++ b/pthread.h
@@ -657,7 +657,7 @@ enum {
struct pthread_once_t_
{
void * lock;
- int done; /* indicates if user function has been executed or cancelled */
+ int init; /* indicates if user function needs executing */
};
diff --git a/pthread_once.c b/pthread_once.c
index efcfd0f..572943f 100644
--- a/pthread_once.c
+++ b/pthread_once.c
@@ -54,13 +54,13 @@ pthread_once (pthread_once_t * once_control, void (*init_routine) (void))
return EINVAL;
}
- if (InterlockedExchangeAdd((LPLONG)&once_control->done, 0L)) /* MBR fence */
+ if (InterlockedExchangeAdd((LPLONG)&once_control->init, 0L)) /* MBR fence */
{
ptw32_mcs_local_node_t node;
ptw32_mcs_lock_acquire((ptw32_mcs_lock_t *)&once_control->lock, &node);
- if (InterlockedExchangeAdd((LPLONG)&once_control->done, 0L))
+ if (once_control->init)
{
#ifdef _MSC_VER
@@ -75,7 +75,7 @@ pthread_once (pthread_once_t * once_control, void (*init_routine) (void))
#pragma inline_depth()
#endif
- (void) PTW32_INTERLOCKED_EXCHANGE((LPLONG)&once_control->done, 0L);
+ once_control->init = 0;
}
ptw32_mcs_lock_release(&node);