about summary refs log tree commit diff
path: root/src/rt/sync/sync.h
diff options
context:
space:
mode:
authorMichael Bebenita <mbebenita@mozilla.com>2010-09-07 18:05:42 -0700
committerMichael Bebenita <mbebenita@mozilla.com>2010-09-07 18:41:07 -0700
commit9b74129a4f2d3edd4502dd263b54535aa67780a0 (patch)
treedaa65eaa3a178bd27e5a97d41be0b81774f7405d /src/rt/sync/sync.h
parent9b8d647af3cf743e22468de44c49bebf4270c8a6 (diff)
downloadrust-9b74129a4f2d3edd4502dd263b54535aa67780a0.tar.gz
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 8c9a13f0f4a..562d2a1b7cd 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 */