Skip to content

Commit

Permalink
WaitFor return value
Browse files Browse the repository at this point in the history
  • Loading branch information
csujedihy committed Jul 19, 2024
1 parent 928c497 commit 7b4f473
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions inc/cxplat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,13 @@ class CxPlatAsync {
}

#if defined(CX_PLATFORM_WINUSER) || defined(CX_PLATFORM_WINKERNEL)
void WaitFor(uint32_t TimeoutMs) noexcept {
bool WaitFor(uint32_t TimeoutMs) noexcept {
if (Initialized) {
CxPlatThreadWaitWithTimeout(&Thread, TimeoutMs);
if (CxPlatThreadWaitWithTimeout(&Thread, TimeoutMs)) {
return true;
}
}
return false;
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/test/lib/ThreadTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void CxPlatTestThreadAsync()
return (void*)(intptr_t)(0xdeadbeaf);
});

Async.WaitFor(50);
TEST_FALSE(Async.WaitFor(50));
TEST_EQUAL(Async.Get(), nullptr);
Async.Wait();
TEST_NOT_EQUAL(Async.Get(), nullptr);
Expand Down

0 comments on commit 7b4f473

Please sign in to comment.