diff options
| author | Spencer T Brody <spencer@mongodb.com> | 2015-06-05 14:16:26 -0400 |
|---|---|---|
| committer | Spencer T Brody <spencer@mongodb.com> | 2015-06-09 15:48:41 -0400 |
| commit | 037a5db982ca2f702cbef80b0a904124fa0d077d (patch) | |
| tree | 509cbd1cb9f37025ad8581b759597b57ecc54785 /src/mongo/executor/task_executor.cpp | |
| parent | dd3b7534dc7f59e16f19fc3bb307844794e65520 (diff) | |
| download | mongo-037a5db982ca2f702cbef80b0a904124fa0d077d.tar.gz | |
SERVER-18623 Wire in TaskExecutor interface and make it compile
Diffstat (limited to 'src/mongo/executor/task_executor.cpp')
| -rw-r--r-- | src/mongo/executor/task_executor.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/mongo/executor/task_executor.cpp b/src/mongo/executor/task_executor.cpp index cef6b704dd6..b5d3ae09723 100644 --- a/src/mongo/executor/task_executor.cpp +++ b/src/mongo/executor/task_executor.cpp @@ -41,14 +41,12 @@ namespace executor { TaskExecutor::CallbackHandle::CallbackHandle(std::shared_ptr<CallbackState> callback) : _callback(std::move(callback)) {} - TaskExecutor::CallbackHandle::~CallbackHandle() = default; TaskExecutor::EventState::EventState() = default; TaskExecutor::EventState::~EventState() = default; TaskExecutor::EventHandle::EventHandle(std::shared_ptr<EventState> event) : _event(std::move(event)) {} - TaskExecutor::EventHandle::~EventHandle() = default; TaskExecutor::CallbackArgs::CallbackArgs(TaskExecutor* theExecutor, const CallbackHandle& theHandle, @@ -72,5 +70,30 @@ namespace executor { response(theResponse) { } + TaskExecutor::CallbackState* TaskExecutor::getCallbackFromHandle( + const CallbackHandle& cbHandle) { + return cbHandle.getCallbackState(); + } + + TaskExecutor::EventState* TaskExecutor::getEventFromHandle(const EventHandle& eventHandle) { + return eventHandle.getEventState(); + } + + void TaskExecutor::signalEvent(const EventHandle& event) { + getEventFromHandle(event)->signal(); + } + + void TaskExecutor::waitForEvent(const EventHandle& event) { + getEventFromHandle(event)->waitUntilSignaled(); + } + + void TaskExecutor::cancel(const CallbackHandle& cbHandle) { + getCallbackFromHandle(cbHandle)->cancel(); + }; + + void TaskExecutor::wait(const CallbackHandle& cbHandle) { + getCallbackFromHandle(cbHandle)->waitForCompletion(); + }; + } // namespace executor } // namespace mongo |
