42 cs_ =
static_cast<void *
>(
new CRITICAL_SECTION());
43 ::InitializeCriticalSection(static_cast<CRITICAL_SECTION *>(cs_));
49 ::DeleteCriticalSection(static_cast<CRITICAL_SECTION *>(cs_));
50 delete static_cast<CRITICAL_SECTION *
>(cs_);
57 ::EnterCriticalSection(static_cast<CRITICAL_SECTION *>(cs_));
60 void Mutex::Unlock() {
62 ::LeaveCriticalSection(static_cast<CRITICAL_SECTION *>(cs_));
65 void Mutex::AssertHeld() {
73 sem1_(::CreateSemaphore(NULL, 0, 10000, NULL)),
74 sem2_(::CreateSemaphore(NULL, 0, 10000, NULL)) {
93 ::WaitForSingleObject(
sem1_, INFINITE);
94 ::ReleaseSemaphore(
sem2_, 1, NULL);
104 ::ReleaseSemaphore(
sem1_, 1, NULL);
105 ::WaitForSingleObject(
sem2_, INFINITE);
115 ::WaitForSingleObject(
sem2_, INFINITE);
125 once->InitOnce(initializer);
130 InterlockedExchangePointer(&p,
rep_);
135 InterlockedExchangePointer(&
rep_, v);
void * Acquire_Load() const
void NoBarrier_Store(void *v)
void * NoBarrier_Load() const
void Release_Store(void *v)
void InitOnce(port::OnceType *, void(*initializer)())