summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/kernel/parallel.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'sca-cpp/trunk/kernel/parallel.hpp')
-rw-r--r--sca-cpp/trunk/kernel/parallel.hpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/sca-cpp/trunk/kernel/parallel.hpp b/sca-cpp/trunk/kernel/parallel.hpp
index 648cd60cfc..57754a33e6 100644
--- a/sca-cpp/trunk/kernel/parallel.hpp
+++ b/sca-cpp/trunk/kernel/parallel.hpp
@@ -26,10 +26,9 @@
* Simple parallel work execution functions.
*/
+#include <unistd.h>
#ifdef WANT_THREADS
#include <pthread.h>
-#include <sys/syscall.h>
-#include <unistd.h>
#endif
#include "function.hpp"
@@ -37,17 +36,20 @@
namespace tuscany {
+/**
+ * Returns the current process id.
+ */
+unsigned long processId() {
+ return (unsigned long)getpid();
+}
+
#ifdef WANT_THREADS
/**
* Returns the current thread id.
*/
-long int threadId() {
-#ifdef IS_DARWIN
- return syscall(SYS_thread_selfid);
-#else
- return syscall(SYS_gettid);
-#endif
+unsigned long threadId() {
+ return (unsigned long)pthread_self();
}
/**
@@ -317,6 +319,15 @@ const bool cancel(worker& w) {
return true;
}
+#else
+
+/**
+ * Returns the current thread id.
+ */
+unsigned long threadId() {
+ return 0;
+}
+
#endif
/**