From: Owen Shepherd Date: Sat, 25 Aug 2012 20:23:17 +0000 (+0100) Subject: opt nothread: Fix call_once to match recent changes to the implementation method X-Git-Url: https://pd.if.org/git/?p=pdclib.old;a=commitdiff_plain;h=7ef2d8e3f973420b1b717525d643e47337557938 opt nothread: Fix call_once to match recent changes to the implementation method --- 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