aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-02-04 00:54:25 +0000
committerDavid Robillard <d@drobilla.net>2013-02-04 00:54:25 +0000
commitb8e54f8f66abaf71927a023e1cfee905842078aa (patch)
treec7f2155cb087ef8163b77b10a650d4e1e75d930d /src
parent84293ab041a44d88f81a46b84cdf72c81fc77675 (diff)
downloadmachina-b8e54f8f66abaf71927a023e1cfee905842078aa.tar.gz
machina-b8e54f8f66abaf71927a023e1cfee905842078aa.tar.bz2
machina-b8e54f8f66abaf71927a023e1cfee905842078aa.zip
Replace Raul::thread with std::thread.
git-svn-id: http://svn.drobilla.net/lad/trunk/machina@5047 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/engine/JackDriver.cpp1
-rw-r--r--src/engine/Slave.hpp27
2 files changed, 13 insertions, 15 deletions
diff --git a/src/engine/JackDriver.cpp b/src/engine/JackDriver.cpp
index 0b25acc..1c90509 100644
--- a/src/engine/JackDriver.cpp
+++ b/src/engine/JackDriver.cpp
@@ -436,7 +436,6 @@ JackDriver::start_record(bool step)
case PlayState::PLAYING:
_recorder = SPtr<Recorder>(
new Recorder(_forge, 1024, _beats_unit, q, step));
- _recorder->start();
_record_dur = 0;
break;
case PlayState::RECORDING:
diff --git a/src/engine/Slave.hpp b/src/engine/Slave.hpp
index 55701a7..74ec06b 100644
--- a/src/engine/Slave.hpp
+++ b/src/engine/Slave.hpp
@@ -17,8 +17,9 @@
#ifndef MACHINA_SLAVE_HPP
#define MACHINA_SLAVE_HPP
+#include <thread>
+
#include "raul/Semaphore.hpp"
-#include "raul/Thread.hpp"
namespace machina {
@@ -27,19 +28,19 @@ namespace machina {
* Use this to perform some task in a separate thread you want to 'drive'
* from a realtime (or otherwise) thread.
*/
-class Slave : public Raul::Thread
+class Slave
{
public:
- Slave() : _whip(0) {}
- ~Slave() {
- _exit_flag = true;
- _whip.post();
- }
+ Slave()
+ : _whip(0)
+ , _exit_flag(false)
+ , _thread(&Slave::_run, this)
+ {}
- virtual void join() {
+ virtual ~Slave() {
_exit_flag = true;
_whip.post();
- Thread::join();
+ _thread.join();
}
/** Tell the slave to do whatever work it does. Realtime safe. */
@@ -58,15 +59,13 @@ protected:
private:
inline void _run() {
- while (true) {
- _whip.wait();
- if (_exit_flag) {
- break;
- }
+ while (_whip.wait() && !_exit_flag) {
_whipped();
}
}
+ bool _exit_flag;
+ std::thread _thread;
};
} // namespace machina