feat(thread): add CCritSect

This commit is contained in:
fallenoak 2023-03-26 23:07:48 -05:00 committed by GitHub
parent 368c2f16c2
commit a500c34d45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 90 additions and 0 deletions

View file

@ -6,6 +6,23 @@ uint32_t threadProc(void* param) {
return 0;
};
TEST_CASE("CCritSect::Enter", "[thread]") {
SECTION("locks critical section") {
CCritSect critSect;
critSect.Enter();
SUCCEED();
}
}
TEST_CASE("CCritSect::Leave", "[thread]") {
SECTION("unlocks critical section") {
CCritSect critSect;
critSect.Enter();
critSect.Leave();
SUCCEED();
}
}
TEST_CASE("SGetCurrentThreadId", "[thread]") {
SECTION("returns thread id") {
uintptr_t threadId = SGetCurrentThreadId();