clean up shutdown
git-svn-id: svn://localhost/ardour2/trunk@1571 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
45e61c210d
commit
3c4cdadfd7
@ -2,6 +2,10 @@
|
||||
where ENSURE_CORRECT_THREAD is a macro that is modelled on ENSURE_GUI_THREAD
|
||||
if the handler is not called in the "correct thread", it will use a pseudo-RT-safe-enough technique to get the correct thread to recall "handler" later on, and return.
|
||||
|
||||
* On shutdown, sometimes: GThread-ERROR **: file gthread-posix.c: line 160 (): error 'Device or resource busy' during 'pthread_mutex_destroy ((pthread_mutex_t *) mutex)'
|
||||
aborting...
|
||||
Aborted
|
||||
|
||||
* jog with transport rolling doesn't work properly. My use of ScrollTimeline also doesn't work.
|
||||
* finish button mapping.
|
||||
* concurrency for bank switching? And make sure "old" events aren't sent to "new" faders
|
||||
|
@ -94,6 +94,7 @@ MackieControlProtocol::MackieControlProtocol (Session& session)
|
||||
, connections_back( _connections )
|
||||
, _surface( 0 )
|
||||
, _ports_changed( false )
|
||||
, _polling( true )
|
||||
, pfd( 0 )
|
||||
, nfds( 0 )
|
||||
{
|
||||
@ -542,7 +543,7 @@ void MackieControlProtocol::connect_session_signals()
|
||||
Sorted sorted = get_sorted_routes();
|
||||
for ( Sorted::iterator it = sorted.begin(); it != sorted.end(); ++it )
|
||||
{
|
||||
(*it)->RemoteControlIDChanged.connect( ( mem_fun (*this, &MackieControlProtocol::notify_remote_id_changed) ) );
|
||||
connections_back = (*it)->RemoteControlIDChanged.connect( ( mem_fun (*this, &MackieControlProtocol::notify_remote_id_changed) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -645,7 +646,7 @@ void MackieControlProtocol::initialize_surface()
|
||||
// Connect events. Must be after route table otherwise there will be trouble
|
||||
for( MackiePorts::iterator it = _ports.begin(); it != _ports.end(); ++it )
|
||||
{
|
||||
(*it)->control_event.connect( ( mem_fun (*this, &MackieControlProtocol::handle_control_event) ) );
|
||||
connections_back = (*it)->control_event.connect( ( mem_fun (*this, &MackieControlProtocol::handle_control_event) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -654,6 +655,16 @@ void MackieControlProtocol::close()
|
||||
// TODO disconnect port active/inactive signals
|
||||
// Or at least put a lock here
|
||||
|
||||
// disconnect global signals from Session
|
||||
// TODO Since *this is a sigc::trackable, this shouldn't be necessary
|
||||
// but it is for some reason
|
||||
#if 0
|
||||
for( vector<sigc::connection>::iterator it = _connections.begin(); it != _connections.end(); ++it )
|
||||
{
|
||||
it->disconnect();
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( _surface != 0 )
|
||||
{
|
||||
// These will fail if the port has gone away.
|
||||
@ -687,19 +698,15 @@ void MackieControlProtocol::close()
|
||||
}
|
||||
}
|
||||
|
||||
// disconnect global signals from Session
|
||||
// TODO Since *this is a sigc::trackable, this shouldn't be necessary
|
||||
for( vector<sigc::connection>::iterator it = _connections.begin(); it != _connections.end(); ++it )
|
||||
{
|
||||
it->disconnect();
|
||||
}
|
||||
|
||||
// disconnect routes from strips
|
||||
clear_route_signals();
|
||||
|
||||
delete _surface;
|
||||
_surface = 0;
|
||||
}
|
||||
|
||||
// stop polling, and wait for it...
|
||||
pthread_cancel_one( thread );
|
||||
_polling = false;
|
||||
pthread_join( thread, 0 );
|
||||
|
||||
// shut down MackiePorts
|
||||
@ -709,7 +716,10 @@ void MackieControlProtocol::close()
|
||||
}
|
||||
_ports.clear();
|
||||
|
||||
// this is done already in monitor_work. But it's here so we know.
|
||||
delete[] pfd;
|
||||
pfd = 0;
|
||||
nfds = 0;
|
||||
}
|
||||
|
||||
void* MackieControlProtocol::_monitor_work (void* arg)
|
||||
@ -1145,7 +1155,7 @@ void MackieControlProtocol::notify_route_added( ARDOUR::Session::RouteList & rl
|
||||
typedef ARDOUR::Session::RouteList ARS;
|
||||
for ( ARS::iterator it = rl.begin(); it != rl.end(); ++it )
|
||||
{
|
||||
(*it)->RemoteControlIDChanged.connect( ( mem_fun (*this, &MackieControlProtocol::notify_remote_id_changed) ) );
|
||||
connections_back = (*it)->RemoteControlIDChanged.connect( ( mem_fun (*this, &MackieControlProtocol::notify_remote_id_changed) ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -296,6 +296,7 @@ class MackieControlProtocol
|
||||
/// true until the port configuration is updated;
|
||||
bool _ports_changed;
|
||||
|
||||
bool _polling;
|
||||
struct pollfd * pfd;
|
||||
int nfds;
|
||||
};
|
||||
|
@ -41,7 +41,7 @@ void * MackieControlProtocol::monitor_work()
|
||||
pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, 0);
|
||||
|
||||
// read from midi ports
|
||||
while ( true )
|
||||
while ( _polling )
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -61,15 +61,12 @@ void * MackieControlProtocol::monitor_work()
|
||||
{
|
||||
cout << "caught exception in MackieControlProtocol::monitor_work " << e.what() << endl;
|
||||
}
|
||||
|
||||
// provide a cancellation point
|
||||
pthread_testcancel();
|
||||
}
|
||||
|
||||
// these never get called because of cancellation point above
|
||||
cout << "MackieControlProtocol::poll_ports exiting" << endl;
|
||||
|
||||
// TODO ports and pfd and nfds should be in a separate class
|
||||
delete[] pfd;
|
||||
pfd = 0;
|
||||
nfds = 0;
|
||||
|
||||
return (void*) 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user