mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-15 19:16:40 +01:00
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
This commit is contained in:
parent
19d1132afb
commit
6636a65c10
4 changed files with 43 additions and 4 deletions
|
|
@ -84,6 +84,8 @@ class Graph : public SessionHandleRef
|
|||
|
||||
void clear_other_chain ();
|
||||
|
||||
bool in_process_thread () const;
|
||||
|
||||
protected:
|
||||
virtual void session_going_away ();
|
||||
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,6 +106,10 @@ def build(bld):
|
|||
whitespace.cc
|
||||
xml++.cc
|
||||
'''
|
||||
|
||||
if bld.env['DEBUG_RT_ALLOC']:
|
||||
obj.source += 'debug_rt_alloc.c'
|
||||
|
||||
obj.export_incdirs = ['.']
|
||||
obj.includes = ['.']
|
||||
obj.name = 'libpbd'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue