about summary refs log tree commit diff
path: root/src/rt/sync/rust_thread.h
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-02-09 14:24:19 -0800
committerBrian Anderson <banderson@mozilla.com>2012-02-09 19:00:16 -0800
commit421c8db14430011d40f8f8499ca4aefbcc26d07e (patch)
treec6cc3269f99dd70e83a10335ac6bc8a6aa64c255 /src/rt/sync/rust_thread.h
parent8ad9cf8087f2d1f1badfb7c8616c0b11cc4aa6db (diff)
downloadrust-421c8db14430011d40f8f8499ca4aefbcc26d07e.tar.gz
rust-421c8db14430011d40f8f8499ca4aefbcc26d07e.zip
rt: Move rust_thread to its own files
Diffstat (limited to 'src/rt/sync/rust_thread.h')
-rw-r--r--src/rt/sync/rust_thread.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/rt/sync/rust_thread.h b/src/rt/sync/rust_thread.h
new file mode 100644
index 00000000000..1c27d1b6597
--- /dev/null
+++ b/src/rt/sync/rust_thread.h
@@ -0,0 +1,26 @@
+#ifndef RUST_THREAD_H
+#define RUST_THREAD_H
+
+/**
+ * Thread utility class. Derive and implement your own run() method.
+ */
+class rust_thread {
+public:
+#if defined(__WIN32__)
+    HANDLE thread;
+#else
+    pthread_t thread;
+#endif
+    rust_thread();
+    void start();
+
+    virtual void run() {
+        return;
+    }
+
+    void join();
+
+    virtual ~rust_thread() {}   // quiet the compiler
+};
+
+#endif /* RUST_THREAD_H */