summaryrefslogtreecommitdiffstats
path: root/raul/Thread.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-08-16 00:59:35 +0000
committerDavid Robillard <d@drobilla.net>2012-08-16 00:59:35 +0000
commit2f719c364449f3e338822e7cc740daac0870cbc9 (patch)
tree349be87a97baf7a48d5c42fc45c1ed5fa006c225 /raul/Thread.hpp
parentadbad7fcffe9fab239da23b846091e88586b3846 (diff)
downloadraul-2f719c364449f3e338822e7cc740daac0870cbc9.tar.gz
raul-2f719c364449f3e338822e7cc740daac0870cbc9.tar.bz2
raul-2f719c364449f3e338822e7cc740daac0870cbc9.zip
Remove Raul::Slave class.
Merge Thread::stop() and Thread::join(). Clean thread shut down without the use of pthread_cancel(). git-svn-id: http://svn.drobilla.net/lad/trunk/raul@4708 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'raul/Thread.hpp')
-rw-r--r--raul/Thread.hpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/raul/Thread.hpp b/raul/Thread.hpp
index 6ac5aeb..f6f57d3 100644
--- a/raul/Thread.hpp
+++ b/raul/Thread.hpp
@@ -37,13 +37,18 @@ class Thread : Noncopyable
public:
virtual ~Thread();
- /** Start the thread if it is not already running. */
+ /** Start the thread if it is not already running.
+ *
+ * This is separate from construction to prevent race conditions during
+ * construction of derived classes.
+ */
virtual void start();
- /** Stop the thread if it is running. */
- virtual void stop();
-
- /** Wait until the thread exits. */
+ /** Stop the thread and block the caller until the thread exits.
+ *
+ * This sets _exit_flag to true, derived classes must ensure they actually
+ * exit when this occurs.
+ */
virtual void join();
/** Set the scheduling policy for this thread.
@@ -55,6 +60,11 @@ public:
const std::string& name() const { return _name; }
protected:
+ /** Construct a thread.
+ *
+ * Note this does not actually start a thread to prevent race conditions
+ * during construction. To actually begin execution, call start().
+ */
explicit Thread(const std::string& name="");
/** Thread function to execute.