From: Owen Shepherd Date: Wed, 22 Aug 2012 21:05:16 +0000 (+0100) Subject: _PDCLIB_ONCE_FLAG_DONE -> _PDCLIB_ONCE_FLAG_IS_DONE(flag) to support once_flag types... X-Git-Url: https://pd.if.org/git/?p=pdclib.old;a=commitdiff_plain;h=d265e525e9f73e8f40fed2686d778339de55f20e _PDCLIB_ONCE_FLAG_DONE -> _PDCLIB_ONCE_FLAG_IS_DONE(flag) to support once_flag types which are not simply comparable (e.g. structures) --- diff --git a/includes/threads.h b/includes/threads.h index c9e3b07..4549883 100644 --- a/includes/threads.h +++ b/includes/threads.h @@ -25,10 +25,10 @@ enum { }; #define ONCE_FLAG_INIT _PDCLIB_ONCE_FLAG_INIT -#if defined(_PDCLIB_ONCE_FLAG_DONE) +#if defined(_PDCLIB_ONCE_FLAG_IS_DONE) static inline void call_once(once_flag *flag, void (*func)(void)) { - if(*flag != _PDCLIB_ONCE_FLAG_DONE) { + if(_PDCLIB_ONCE_FLAG_IS_DONE(flag)) { _PDCLIB_call_once(flag, func); } } diff --git a/opt/nothread/_PDCLIB_threadconfig.h b/opt/nothread/_PDCLIB_threadconfig.h index 39478e9..ceeaac4 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_DONE 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));