From 80266e43b4d21ea5eb4376dbedad02b767244cf7 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 11 May 2012 23:17:51 +0000 Subject: Hide pthread stuff from public headers. git-svn-id: http://svn.drobilla.net/lad/trunk/raul@4360 a436a847-0d15-0410-975c-d299462d15a1 --- raul/Slave.hpp | 1 - raul/Thread.hpp | 27 ++++++--------------------- 2 files changed, 6 insertions(+), 22 deletions(-) (limited to 'raul') diff --git a/raul/Slave.hpp b/raul/Slave.hpp index a301bc4..95bff5c 100644 --- a/raul/Slave.hpp +++ b/raul/Slave.hpp @@ -18,7 +18,6 @@ #ifndef RAUL_SLAVE_HPP #define RAUL_SLAVE_HPP -#include #include "raul/Semaphore.hpp" #include "raul/Thread.hpp" 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 #include -#include - #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 _contexts; std::string _name; - bool _pthread_exists; + bool _thread_exists; bool _own_thread; - pthread_t _pthread; }; } // namespace Raul -- cgit v1.2.1