diff options
author | David Robillard <d@drobilla.net> | 2012-05-14 05:45:15 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-05-14 05:45:15 +0000 |
commit | ff4c3ff14e76e5b06f1b4c44f03f900e1bd4ac50 (patch) | |
tree | a66a97f7f842caa51ee6891d2f5037b6707c6784 /raul/Thread.hpp | |
parent | 79deafe642561936ebb3bbcf585f2c6f26b456d3 (diff) | |
download | raul-ff4c3ff14e76e5b06f1b4c44f03f900e1bd4ac50.tar.gz raul-ff4c3ff14e76e5b06f1b4c44f03f900e1bd4ac50.tar.bz2 raul-ff4c3ff14e76e5b06f1b4c44f03f900e1bd4ac50.zip |
Clean up Thread interface.
git-svn-id: http://svn.drobilla.net/lad/trunk/raul@4411 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'raul/Thread.hpp')
-rw-r--r-- | raul/Thread.hpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/raul/Thread.hpp b/raul/Thread.hpp index 9b61048..021bf86 100644 --- a/raul/Thread.hpp +++ b/raul/Thread.hpp @@ -39,27 +39,32 @@ class Thread : Noncopyable public: virtual ~Thread(); - static Thread* create(const std::string& name="") - { return new Thread(name); } - - static Thread* create_for_this_thread(const std::string& name=""); + /** Create a new thread. */ + static Thread* create(const std::string& name="") { + return new Thread(name); + } /** Return the calling thread. * * If the calling thread does not yet have a Thread object associated with - * it, one will be created. + * it yet, one will be created with the given name. */ static Thread& get(const std::string& name=""); + /** Start the thread if it is not already running. */ virtual void start(); + + /** Stop the thread if it is running. */ virtual void stop(); + /** Wait until the thread exits. */ virtual void join(); - void set_scheduling(int policy, unsigned int priority); + /** Set the scheduling policy for this thread. */ + virtual void set_scheduling(bool realtime, unsigned priority); + /** Return the name of this thread. */ const std::string& name() const { return _name; } - void set_name(const std::string& name) { _name = name; } protected: explicit Thread(const std::string& name=""); @@ -75,8 +80,6 @@ protected: */ virtual void _run() {} - bool _exit_flag; - private: static void* _static_run(void* me); @@ -84,6 +87,9 @@ private: std::string _name; bool _thread_exists; bool _own_thread; + +protected: + bool _exit_flag; }; } // namespace Raul |