From d265e525e9f73e8f40fed2686d778339de55f20e Mon Sep 17 00:00:00 2001 From: Owen Shepherd Date: Wed, 22 Aug 2012 22:05:16 +0100 Subject: [PATCH] _PDCLIB_ONCE_FLAG_DONE -> _PDCLIB_ONCE_FLAG_IS_DONE(flag) to support once_flag types which are not simply comparable (e.g. structures) --- includes/threads.h | 4 ++-- opt/nothread/_PDCLIB_threadconfig.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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)); -- 2.40.0