[threading linux] Implement Events
Remove file-descriptor specific wait implementation to PosixFdHandle class which breaks on waits of non-fd handles. Replace with PosixConditionHandle and extend to support auto reset and initial values. Simplify mutex and conditional variable use with stdlib versions which wrap these primitives but provide better C++ interface. Test Event and Reset
This commit is contained in:
committed by
Rick Gibbed
parent
f9d708265f
commit
9d20adfa77
@@ -189,8 +189,27 @@ TEST_CASE("Wait on Event", "Event") {
|
||||
// Call wait on now consumed Event
|
||||
result = Wait(evt.get(), false, 50ms);
|
||||
REQUIRE(result == WaitResult::kTimeout);
|
||||
}
|
||||
|
||||
// TODO(bwrsandman): test Reset() and Pulse()
|
||||
TEST_CASE("Reset Event", "Event") {
|
||||
auto evt = Event::CreateAutoResetEvent(false);
|
||||
WaitResult result;
|
||||
|
||||
// Call wait on reset Event
|
||||
evt->Set();
|
||||
evt->Reset();
|
||||
result = Wait(evt.get(), false, 50ms);
|
||||
REQUIRE(result == WaitResult::kTimeout);
|
||||
|
||||
// Test resetting the unset event
|
||||
evt->Reset();
|
||||
result = Wait(evt.get(), false, 50ms);
|
||||
REQUIRE(result == WaitResult::kTimeout);
|
||||
|
||||
// Test setting the reset event
|
||||
evt->Set();
|
||||
result = Wait(evt.get(), false, 50ms);
|
||||
REQUIRE(result == WaitResult::kSuccess);
|
||||
}
|
||||
|
||||
TEST_CASE("Wait on Semaphore", "Semaphore") {
|
||||
|
||||
Reference in New Issue
Block a user