aboutsummaryrefslogtreecommitdiff
path: root/src/rt/sync/sync.h
diff options
context:
space:
mode:
authorMichael Bebenita <[email protected]>2010-09-07 18:05:42 -0700
committerMichael Bebenita <[email protected]>2010-09-07 18:41:07 -0700
commit9b74129a4f2d3edd4502dd263b54535aa67780a0 (patch)
treedaa65eaa3a178bd27e5a97d41be0b81774f7405d /src/rt/sync/sync.h
parentMake run.py only search in the run-pass directory. (diff)
downloadrust-9b74129a4f2d3edd4502dd263b54535aa67780a0.tar.xz
rust-9b74129a4f2d3edd4502dd263b54535aa67780a0.zip
Added a thread utility class to factor out operations on threads.
Diffstat (limited to 'src/rt/sync/sync.h')
-rw-r--r--src/rt/sync/sync.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/rt/sync/sync.h b/src/rt/sync/sync.h
index 8c9a13f0..562d2a1b 100644
--- a/src/rt/sync/sync.h
+++ b/src/rt/sync/sync.h
@@ -11,4 +11,25 @@ public:
}
};
+/**
+ * Thread utility class. Derive and implement your own run() method.
+ */
+class rust_thread {
+public:
+#if defined(__WIN32__)
+ HANDLE thread;
+#else
+ pthread_t thread;
+#endif
+ void start();
+
+ virtual void run() {
+ return;
+ }
+
+ void join();
+
+ bool is_running();
+};
+
#endif /* SYNC_H */