summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrpj <rpj>2011-06-30 03:44:25 +0000
committerrpj <rpj>2011-06-30 03:44:25 +0000
commita06b69802cfe62845deb4521d2a3029da4387993 (patch)
treea187b20d63f1dc444ec5a72b31164949e4aec5df
parent6e72bdd7414dff1db49dd943f440b201038a4576 (diff)
See the ChangeLog
-rw-r--r--ChangeLog4
-rw-r--r--pthread_once.c13
2 files changed, 5 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 7b371c3..e27134d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,9 @@
2011-06-30 Ross Johnson <ross dot johnson at homemail dot com dot au>
* pthread_once.c: Tighten 'if' statement casting; fix interlocked
- pointer cast for 64 bit compatibility (missed yesterday).
+ pointer cast for 64 bit compatibility (missed yesterday); remove
+ the superfluous static cleanup routine and call the release routine
+ directly if popped.
* create.c (stackSize): Now type size_t.
2011-06-29 Daniel Richard G. <skunk at iskunk dot org>
diff --git a/pthread_once.c b/pthread_once.c
index e18726c..fcfd999 100644
--- a/pthread_once.c
+++ b/pthread_once.c
@@ -37,15 +37,6 @@
#include "pthread.h"
#include "implement.h"
-
-static void PTW32_CDECL
-ptw32_once_on_init_cancel (void * arg)
-{
- /* when the initing thread is cancelled we have to release the lock */
- ptw32_mcs_local_node_t* nodePtr = (ptw32_mcs_local_node_t *)arg;
- ptw32_mcs_lock_release(nodePtr);
-}
-
int
pthread_once (pthread_once_t * once_control, void (*init_routine) (void))
{
@@ -54,7 +45,7 @@ pthread_once (pthread_once_t * once_control, void (*init_routine) (void))
return EINVAL;
}
- if ((PTW32_INTERLOCKED_VALUE)0 ==
+ if ((PTW32_INTERLOCKED_VALUE)PTW32_FALSE ==
(PTW32_INTERLOCKED_VALUE)PTW32_INTERLOCKED_EXCHANGE_ADD((PTW32_INTERLOCKED_PTR)&once_control->done,
(PTW32_INTERLOCKED_VALUE)0)) /* MBR fence */
{
@@ -69,7 +60,7 @@ pthread_once (pthread_once_t * once_control, void (*init_routine) (void))
#pragma inline_depth(0)
#endif
- pthread_cleanup_push(ptw32_once_on_init_cancel, (void *)&node);
+ pthread_cleanup_push(ptw32_mcs_lock_release, &node);
(*init_routine)();
pthread_cleanup_pop(0);