diff options
Diffstat (limited to 'dep/src/zthread/SynchronousExecutor.cxx')
-rw-r--r-- | dep/src/zthread/SynchronousExecutor.cxx | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/dep/src/zthread/SynchronousExecutor.cxx b/dep/src/zthread/SynchronousExecutor.cxx index 0dc75b5f676..da49797ee94 100644 --- a/dep/src/zthread/SynchronousExecutor.cxx +++ b/dep/src/zthread/SynchronousExecutor.cxx @@ -24,12 +24,12 @@ namespace ZThread { - SynchronousExecutor::SynchronousExecutor() + SynchronousExecutor::SynchronousExecutor() : _canceled(false) {} SynchronousExecutor::~SynchronousExecutor() { } - + void SynchronousExecutor::cancel() { Guard<Mutex> g(_lock); @@ -38,41 +38,41 @@ namespace ZThread { } bool SynchronousExecutor::isCanceled() { - + Guard<Mutex> g(_lock); return _canceled; - + } void SynchronousExecutor::interrupt() { } void SynchronousExecutor::execute(const Task& task) { - - // Canceled Executors will not accept new tasks, quick + + // Canceled Executors will not accept new tasks, quick // check to avoid excessive locking in the canceled state - if(_canceled) + if(_canceled) throw Cancellation_Exception(); - + Guard<Mutex> g(_lock); - + if(_canceled) // Double check throw Cancellation_Exception(); - + // Run the task. Task(task)->run(); - - } + + } void SynchronousExecutor::wait() { - + if(Thread::interrupted()) throw Interrupted_Exception(); - + Guard<Mutex> g(_lock); - + } - + /** * @see Executor::wait(unsigned long) */ @@ -80,11 +80,11 @@ namespace ZThread { if(Thread::interrupted()) throw Interrupted_Exception(); - + Guard<Mutex> g(_lock); return true; - + } - - + + } |