summaryrefslogtreecommitdiffstats
path: root/src/server/PreProcessor.cpp
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
commit46c3a486eee4b2ef69d9cc4f9e2701082c64d7c8 (patch)
treeecf7a89fb1c28a619106dd78ccd257a1ff52c70a /src/server/PreProcessor.cpp
parent69f98d63f5bd22c82208fef5fbc2a61613541bd7 (diff)
downloadingen-46c3a486eee4b2ef69d9cc4f9e2701082c64d7c8.tar.gz
ingen-46c3a486eee4b2ef69d9cc4f9e2701082c64d7c8.tar.bz2
ingen-46c3a486eee4b2ef69d9cc4f9e2701082c64d7c8.zip
Replace Raul::thread with std::thread.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5047 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/PreProcessor.cpp')
-rw-r--r--src/server/PreProcessor.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/server/PreProcessor.cpp b/src/server/PreProcessor.cpp
index d62fdab3..83215bee 100644
--- a/src/server/PreProcessor.cpp
+++ b/src/server/PreProcessor.cpp
@@ -14,6 +14,9 @@
along with Ingen. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <stdexcept>
+#include <iostream>
+
#include "Event.hpp"
#include "PostProcessor.hpp"
#include "PreProcessor.hpp"
@@ -26,19 +29,19 @@ namespace Ingen {
namespace Server {
PreProcessor::PreProcessor()
- : Raul::Thread()
- , _sem(0)
+ : _sem(0)
, _head(NULL)
, _prepared_back(NULL)
, _tail(NULL)
-{
- start();
-}
+ , _exit_flag(false)
+ , _thread(&PreProcessor::run, this)
+{}
PreProcessor::~PreProcessor()
{
_exit_flag = true;
_sem.post();
+ _thread.join();
}
void
@@ -46,7 +49,7 @@ PreProcessor::event(Event* const ev)
{
// TODO: Probably possible to make this lock-free with CAS
ThreadManager::assert_not_thread(THREAD_IS_REAL_TIME);
- Glib::Mutex::Lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
assert(!ev->is_prepared());
assert(!ev->next());
@@ -114,7 +117,7 @@ PreProcessor::process(ProcessContext& context, PostProcessor& dest, bool limit)
}
void
-PreProcessor::_run()
+PreProcessor::run()
{
ThreadManager::set_flag(THREAD_PRE_PROCESS);
while (_sem.wait() && !_exit_flag) {