Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CxPlatAsync WaitFor() returns a bool to indicate whether it times out or not #50

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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