From 7ef2d8e3f973420b1b717525d643e47337557938 Mon Sep 17 00:00:00 2001 From: Owen Shepherd Date: Sat, 25 Aug 2012 21:23:17 +0100 Subject: [PATCH] opt nothread: Fix call_once to match recent changes to the implementation method --- opt/nothread/_PDCLIB_threadconfig.h | 2 +- opt/nothread/call_once.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/opt/nothread/_PDCLIB_threadconfig.h b/opt/nothread/_PDCLIB_threadconfig.h index ceeaac4..3380b52 100644 --- a/opt/nothread/_PDCLIB_threadconfig.h +++ b/opt/nothread/_PDCLIB_threadconfig.h @@ -5,7 +5,7 @@ _PDCLIB_BEGIN_EXTERN_C #define _PDCLIB_ONCE_FLAG_INIT 0 -#define _PDCLIB_ONCE_FLAG_IS_DONE(_f) ((_f) == 1) +#define _PDCLIB_ONCE_FLAG_IS_DONE(_f) (*(_f) == 1) typedef char _PDCLIB_once_flag; void _PDCLIB_call_once(_PDCLIB_once_flag *flag, void (*func)(void)); diff --git a/opt/nothread/call_once.c b/opt/nothread/call_once.c index 8320170..cce9a49 100644 --- a/opt/nothread/call_once.c +++ b/opt/nothread/call_once.c @@ -3,9 +3,9 @@ void _PDCLIB_call_once(_PDCLIB_once_flag *flag, void (*func)(void)) { - if(*flag != _PDCLIB_ONCE_FLAG_DONE) { + if(!_PDCLIB_ONCE_FLAG_IS_DONE(flag)) { func(); - *flag = _PDCLIB_ONCE_FLAG_DONE; + *flag = 1; } } #endif -- 2.40.0