AudioRender/AudioRender/Windows/SectionLock.cpp
2024-09-29 00:29:59 +08:00

23 lines
431 B
C++

#include "Windows/SectionLock.h"
SectionLock::SectionLock() noexcept {
InitializeCriticalSection(&section_);
}
SectionLock::~SectionLock() {
DeleteCriticalSection(&section_);
}
void SectionLock::Lock() {
EnterCriticalSection(&section_);
}
bool SectionLock::TryLock() {
bool success = TryEnterCriticalSection(&section_);
return success;
}
void SectionLock::UnLock() {
LeaveCriticalSection(&section_);
}