base: correct Windows heim_base_once_f semantics

As implemented by Jeffrey Altman heim_base_once_f() is a variant of the
"double-checked gate lock pattern".   Full memory barriers must be used
when determining whether or not to call SwitchToThread().

Change-Id: I2f8446a56c50a37c921d6e993433c9a3f7488f50
This commit is contained in:
Nicolas Williams
2015-11-30 00:47:54 -05:00
committed by Jeffrey Altman
parent 4735faba59
commit cc0e92a3c3
2 changed files with 17 additions and 7 deletions

View File

@@ -58,10 +58,9 @@ typedef heim_object_t heim_bool_t;
typedef heim_object_t heim_null_t;
#if defined(WIN32)
typedef struct {
LONG started;
LONG running;
LONG state;
} heim_base_once_t;
# define HEIM_BASE_ONCE_INIT {0L, 0L}
# define HEIM_BASE_ONCE_INIT {0L}
#else
# define HEIM_BASE_ONCE_INIT 0
typedef long heim_base_once_t; /* XXX arch dependant */