summaryrefslogtreecommitdiffstats
path: root/cpp/sca/kernel/parallel.hpp
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2009-10-11 00:01:04 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2009-10-11 00:01:04 +0000
commita64c1ec2a50f62d63872eac6bc740966602e87bd (patch)
treee4eab2e74b82eb51c4a5d9b3a132506895974f93 /cpp/sca/kernel/parallel.hpp
parent89246640ca239097800fed58e7abc5bc050e3f56 (diff)
Some code cleanup, removed unused functions, changed == empty-list to isNil to avoid unnecessary construction of empty lists, replaced some casts by generic declarations. Added simple maybe, failable and state monad classes to help return optional objects or failures and carry state around. Added utility functions to zip and unzip list.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@823981 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--cpp/sca/kernel/parallel.hpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/cpp/sca/kernel/parallel.hpp b/cpp/sca/kernel/parallel.hpp
index 82983d9edc..07d1471152 100644
--- a/cpp/sca/kernel/parallel.hpp
+++ b/cpp/sca/kernel/parallel.hpp
@@ -254,9 +254,9 @@ template<typename R> const future<R> submit(worker& w, const lambda<R()>& func)
* Enqueues shutdown requests.
*/
const bool shutdownEnqueue(const list<pthread_t>& threads, queue<lambda<bool()> >& work) {
- if (threads == list<pthread_t>())
+ if (isNil(threads))
return true;
- enqueue(work, unit(false));
+ enqueue(work, result(false));
return shutdownEnqueue(cdr(threads), work);
}
@@ -264,7 +264,7 @@ const bool shutdownEnqueue(const list<pthread_t>& threads, queue<lambda<bool()>
* Waits for shut down threads to terminate.
*/
const bool shutdownJoin(const list<pthread_t>& threads) {
- if (threads == list<pthread_t>())
+ if (isNil(threads))
return true;
pthread_join(car(threads), NULL);
return shutdownJoin(cdr(threads));