base: Windows implementation of heim_base_once

Provide a Windows implementation of heim_base_once that relies upon
InterlockedCompareExchange() and SwitchToThread().

Change-Id: I9cdbda796d1a27fe1e17be63f287b10132858d7f
This commit is contained in:
Jeffrey Altman
2015-11-29 12:13:01 -05:00
parent 6fbe672451
commit 4735faba59
2 changed files with 19 additions and 2 deletions

View File

@@ -56,8 +56,16 @@ typedef void * heim_object_t;
typedef unsigned int heim_tid_t;
typedef heim_object_t heim_bool_t;
typedef heim_object_t heim_null_t;
#define HEIM_BASE_ONCE_INIT 0
#if defined(WIN32)
typedef struct {
LONG started;
LONG running;
} heim_base_once_t;
# define HEIM_BASE_ONCE_INIT {0L, 0L}
#else
# define HEIM_BASE_ONCE_INIT 0
typedef long heim_base_once_t; /* XXX arch dependant */
#endif
#if !defined(__has_extension)
#define __has_extension(x) 0