summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-09-24 05:29:58 +0000
committerDavid Robillard <d@drobilla.net>2011-09-24 05:29:58 +0000
commit9f592742188c11be69caf14e0f2b711e0be13ce4 (patch)
tree0801f45ff0444a7f46704da01cd343585d84e996 /src
parent9085d33b7600fd2721f0a2401a4e69830c457f84 (diff)
downloadingen-9f592742188c11be69caf14e0f2b711e0be13ce4.tar.gz
ingen-9f592742188c11be69caf14e0f2b711e0be13ce4.tar.bz2
ingen-9f592742188c11be69caf14e0f2b711e0be13ce4.zip
Fix crash with parallel execution.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3490 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/server/Buffer.hpp15
-rw-r--r--src/server/ProcessSlave.hpp3
2 files changed, 12 insertions, 6 deletions
diff --git a/src/server/Buffer.hpp b/src/server/Buffer.hpp
index e44915b3..45afa6aa 100644
--- a/src/server/Buffer.hpp
+++ b/src/server/Buffer.hpp
@@ -18,13 +18,17 @@
#ifndef INGEN_ENGINE_BUFFER_HPP
#define INGEN_ENGINE_BUFFER_HPP
-#include <cstddef>
#include <cassert>
-#include <boost/utility.hpp>
+#include <cstddef>
+
#include <boost/intrusive_ptr.hpp>
+#include <boost/utility.hpp>
+
+#include "ingen/PortType.hpp"
+#include "raul/AtomicInt.hpp"
#include "raul/Deletable.hpp"
#include "raul/SharedPtr.hpp"
-#include "ingen/PortType.hpp"
+
#include "types.hpp"
#include "BufferFactory.hpp"
@@ -68,7 +72,6 @@ public:
inline void ref() { ++_refs; }
inline void deref() {
- assert(_refs > 0);
if ((--_refs) == 0)
_factory.recycle(this);
}
@@ -82,8 +85,8 @@ protected:
virtual ~Buffer() {}
private:
- Buffer* _next; ///< Intrusive linked list for BufferFactory
- size_t _refs; ///< Intrusive reference count for intrusive_ptr
+ Buffer* _next; ///< Intrusive linked list for BufferFactory
+ Raul::AtomicInt _refs; ///< Intrusive reference count for intrusive_ptr
};
} // namespace Server
diff --git a/src/server/ProcessSlave.hpp b/src/server/ProcessSlave.hpp
index 4fb4b9d5..620c58e9 100644
--- a/src/server/ProcessSlave.hpp
+++ b/src/server/ProcessSlave.hpp
@@ -27,6 +27,7 @@
#include "Driver.hpp"
#include "Engine.hpp"
#include "ProcessContext.hpp"
+#include "ThreadManager.hpp"
namespace Ingen {
namespace Server {
@@ -53,6 +54,8 @@ public:
if (realtime)
set_scheduling(SCHED_FIFO, 40);
+
+ set_context(THREAD_PROCESS);
}
~ProcessSlave() {