-
Type:
Improvement
-
Resolution: Won't Fix
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Networking, Sharding
-
None
-
Sharding
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Rationale:
To make Events more useful (and more akin to regular event programming), they should be able to report the status of the Event they were tracking.
Possible implementation:
- Add a Status field to TaskExecutor::EventState
- Add a TaskExecutor::setEventStatus(const EventHandle& event, Status status) method (that takes the same lock as TaskExecutor::waitForEvent) to set the EventState's status
- Make TaskExecutor::waitForEvent(const EventHandle& event) return the eventState's Status:
void ThreadPoolTaskExecutor::waitForEvent(const EventHandle& event) { invariant(event.isValid()); auto eventState = checked_cast<EventState*>(getEventFromHandle(event)); stdx::unique_lock<stdx::mutex> lk(_mutex); while (!eventState->isSignaledFlag) { eventState->isSignaledCondition.wait(lk); } + return eventState->status }