summaryrefslogtreecommitdiff
path: root/libs/ardour/graph.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-01-19 21:36:38 +0000
committerCarl Hetherington <carl@carlh.net>2011-01-19 21:36:38 +0000
commit6636a65c100869e1d479cac97769fbaede7746c7 (patch)
treeaee411a92e2453712fb699893d4313ebd4ef7fca /libs/ardour/graph.cc
parent19d1132afb8d1877f7b3e7c1ff27a11503f1b56d (diff)
Configure option to abort when malloc is called in the process thread.
git-svn-id: svn://localhost/ardour2/branches/3.0@8548 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/graph.cc')
-rw-r--r--libs/ardour/graph.cc31
1 files changed, 28 insertions, 3 deletions
diff --git a/libs/ardour/graph.cc b/libs/ardour/graph.cc
index 0d3749aff0..7cddd522e1 100644
--- a/libs/ardour/graph.cc
+++ b/libs/ardour/graph.cc
@@ -22,6 +22,7 @@
#include "pbd/compose.h"
#include "pbd/cpus.h"
+#include "pbd/debug_rt_alloc.h"
#include "ardour/debug.h"
#include "ardour/graph.h"
@@ -39,6 +40,17 @@ using namespace ARDOUR;
using namespace PBD;
using namespace std;
+#ifdef DEBUG_RT_ALLOC
+static Graph* graph = 0;
+extern "C" {
+
+int alloc_allowed ()
+{
+ return !graph->in_process_thread ();
+}
+
+}
+#endif
Graph::Graph (Session & session)
: SessionHandleRef (session)
@@ -97,6 +109,11 @@ Graph::Graph (Session & session)
_thread_list.push_back (a_thread);
}
}
+
+#ifdef DEBUG_RT_ALLOC
+ graph = this;
+ pbd_alloc_allowed = &::alloc_allowed;
+#endif
}
void
@@ -380,7 +397,7 @@ static void get_rt()
void
Graph::helper_thread()
{
- ProcessThread *pt = new ProcessThread;
+ ProcessThread* pt = new ProcessThread ();
pt->get_buffers();
get_rt();
@@ -397,7 +414,7 @@ Graph::helper_thread()
void
Graph::main_thread()
{
- ProcessThread *pt = new ProcessThread;
+ ProcessThread* pt = new ProcessThread ();
pt->get_buffers();
get_rt();
@@ -557,5 +574,13 @@ Graph::process_one_route (Route* route)
}
}
+bool
+Graph::in_process_thread () const
+{
+ list<pthread_t>::const_iterator i = _thread_list.begin ();
+ while (i != _thread_list.end() && *i != pthread_self ()) {
+ ++i;
+ }
-
+ return i != _thread_list.end ();
+}