diff options
author | David Robillard <d@drobilla.net> | 2012-05-11 23:17:51 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-05-11 23:17:51 +0000 |
commit | 80266e43b4d21ea5eb4376dbedad02b767244cf7 (patch) | |
tree | 698972d9efacbd4cdcb0147b6173d1252f392579 /raul/Thread.hpp | |
parent | d0bdce351a454f3fafa7d61d7bbe4f7c07cf81e3 (diff) | |
download | raul-80266e43b4d21ea5eb4376dbedad02b767244cf7.tar.gz raul-80266e43b4d21ea5eb4376dbedad02b767244cf7.tar.bz2 raul-80266e43b4d21ea5eb4376dbedad02b767244cf7.zip |
Hide pthread stuff from public headers.
git-svn-id: http://svn.drobilla.net/lad/trunk/raul@4360 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'raul/Thread.hpp')
-rw-r--r-- | raul/Thread.hpp | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/raul/Thread.hpp b/raul/Thread.hpp index ecd896e..bc469f4 100644 --- a/raul/Thread.hpp +++ b/raul/Thread.hpp @@ -21,12 +21,12 @@ #include <set> #include <string> -#include <pthread.h> - #include "raul/Noncopyable.hpp" namespace Raul { +struct ThreadImpl; + /** Abstract base class for a thread. * * Extend this and override the _run method to easily create a thread @@ -39,16 +39,12 @@ namespace Raul { class Thread : Noncopyable { public: - virtual ~Thread() { - stop(); - } + virtual ~Thread(); static Thread* create(const std::string& name="") { return new Thread(name); } - /** Must be called from thread */ - static Thread* create_for_this_thread(const std::string& name="") - { return new Thread(pthread_self(), name); } + static Thread* create_for_this_thread(const std::string& name=""); static Thread& get(); @@ -84,22 +80,11 @@ protected: private: static void* _static_run(void* me); - /** Allocate thread-specific data key */ - static void thread_key_alloc() { - pthread_key_create(&_thread_key, NULL); - } - - /* Key for the thread-specific buffer */ - static pthread_key_t _thread_key; - - /* Once-only initialisation of the key */ - static pthread_once_t _thread_key_once; - + ThreadImpl* _impl; std::set<unsigned> _contexts; std::string _name; - bool _pthread_exists; + bool _thread_exists; bool _own_thread; - pthread_t _pthread; }; } // namespace Raul |