aboutsummaryrefslogtreecommitdiff
path: root/dep/src/zthread/SynchronousExecutor.cxx
diff options
context:
space:
mode:
authormegamage <none@none>2009-02-18 11:36:19 -0600
committermegamage <none@none>2009-02-18 11:36:19 -0600
commit31637d4aac6ae2081ccb3db976cab17936019f1a (patch)
treea0e098d4afafaddcb901486d00da1563ecd628b9 /dep/src/zthread/SynchronousExecutor.cxx
parent017f309b5b5b981b6edfe0ae071971d513828a20 (diff)
parent7bff1c1d60b78ba78f2ab0a9c67bdde80427ea30 (diff)
*Merge.
--HG-- branch : trunk
Diffstat (limited to 'dep/src/zthread/SynchronousExecutor.cxx')
-rw-r--r--dep/src/zthread/SynchronousExecutor.cxx40
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;
-
+
}
-
-
+
+
}