summaryrefslogtreecommitdiffstats
path: root/raul
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-05-11 23:17:51 +0000
committerDavid Robillard <d@drobilla.net>2012-05-11 23:17:51 +0000
commit80266e43b4d21ea5eb4376dbedad02b767244cf7 (patch)
tree698972d9efacbd4cdcb0147b6173d1252f392579 /raul
parentd0bdce351a454f3fafa7d61d7bbe4f7c07cf81e3 (diff)
downloadraul-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')
-rw-r--r--raul/Slave.hpp1
-rw-r--r--raul/Thread.hpp27
2 files changed, 6 insertions, 22 deletions
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 <pthread.h>
#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 <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