Details
-
Improvement
-
Resolution: Won't Fix
-
Major - P3
-
None
-
None
-
None
-
Sharding
Description
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
|
}
|