aboutsummaryrefslogtreecommitdiff
path: root/src/rt
diff options
context:
space:
mode:
authorMichael Bebenita <[email protected]>2010-08-09 07:42:06 -0700
committerMichael Bebenita <[email protected]>2010-08-09 07:42:06 -0700
commit9ff6a3d031d2ffaf2863e2a866f7a96ed7ddd029 (patch)
treefc1d740c0715011adbf2169b9b0ad9845d7bc19b /src/rt
parentMade the runtime keep track of all live domains and print their state. (diff)
downloadrust-9ff6a3d031d2ffaf2863e2a866f7a96ed7ddd029.tar.xz
rust-9ff6a3d031d2ffaf2863e2a866f7a96ed7ddd029.zip
Added class to abstract away platform specific thread primitives.
Diffstat (limited to 'src/rt')
-rw-r--r--src/rt/sync/sync.cpp12
-rw-r--r--src/rt/sync/sync.h9
2 files changed, 21 insertions, 0 deletions
diff --git a/src/rt/sync/sync.cpp b/src/rt/sync/sync.cpp
new file mode 100644
index 00000000..eba51a49
--- /dev/null
+++ b/src/rt/sync/sync.cpp
@@ -0,0 +1,12 @@
+#include "../globals.h"
+#include "sync.h"
+
+void sync::yield() {
+#ifdef __APPLE__
+ pthread_yield_np();
+#elif __WIN32__
+
+#else
+ pthread_yield();
+#endif
+}
diff --git a/src/rt/sync/sync.h b/src/rt/sync/sync.h
new file mode 100644
index 00000000..902b5661
--- /dev/null
+++ b/src/rt/sync/sync.h
@@ -0,0 +1,9 @@
+#ifndef SYNC_H
+#define SYNC_H
+
+class sync {
+public:
+ static void yield();
+};
+
+#endif /* SYNC_H */