mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-24 15:37:48 +01:00
wrap PBD::Thread... signals in a mutex to avoid crashing as multiple threads call it simultaneously; increase FUDGE distance for GTK/X11 when sizing comboboxselectors in editor
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4099 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
d410d82ad8
commit
99aad0d4df
19 changed files with 38 additions and 23 deletions
|
|
@ -2789,7 +2789,7 @@ Editor::setup_toolbar ()
|
|||
#ifdef GTKOSX
|
||||
const guint32 FUDGE = 38; // Combo's are stupid - they steal space from the entry for the button
|
||||
#else
|
||||
const guint32 FUDGE = 18; // Combo's are stupid - they steal space from the entry for the button
|
||||
const guint32 FUDGE = 24; // Combo's are stupid - they steal space from the entry for the button
|
||||
#endif
|
||||
|
||||
/* Mode Buttons (tool selection) */
|
||||
|
|
|
|||
|
|
@ -864,7 +864,7 @@ Editor::finish_bringing_in_audio (boost::shared_ptr<AudioRegion> region, uint32_
|
|||
void *
|
||||
Editor::_import_thread (void *arg)
|
||||
{
|
||||
PBD::ThreadCreated (pthread_self(), X_("Import"));
|
||||
PBD::notify_gui_about_thread_creation (pthread_self(), X_("Import"));
|
||||
|
||||
Editor *ed = (Editor *) arg;
|
||||
return ed->import_thread ();
|
||||
|
|
|
|||
|
|
@ -3554,7 +3554,7 @@ Editor::unfreeze_route ()
|
|||
void*
|
||||
Editor::_freeze_thread (void* arg)
|
||||
{
|
||||
PBD::ThreadCreated (pthread_self(), X_("Freeze"));
|
||||
PBD::notify_gui_about_thread_creation (pthread_self(), X_("Freeze"));
|
||||
return static_cast<Editor*>(arg)->freeze_thread ();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -427,7 +427,7 @@ Editor::do_timefx (TimeFXDialog& dialog)
|
|||
void*
|
||||
Editor::timefx_thread (void *arg)
|
||||
{
|
||||
PBD::ThreadCreated (pthread_self(), X_("TimeFX"));
|
||||
PBD::notify_gui_about_thread_creation (pthread_self(), X_("TimeFX"));
|
||||
|
||||
TimeFXDialog* tsd = static_cast<TimeFXDialog*>(arg);
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ ExportRegionDialog::export_audio_data()
|
|||
void*
|
||||
ExportRegionDialog::_export_region_thread (void *arg)
|
||||
{
|
||||
PBD::ThreadCreated (pthread_self(), X_("Export Region"));
|
||||
PBD::notify_gui_about_thread_creation (pthread_self(), X_("Export Region"));
|
||||
|
||||
static_cast<ExportRegionDialog*>(arg)->export_region ();
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -714,7 +714,7 @@ SoundFileBrowser::found_search_clicked ()
|
|||
void*
|
||||
freesound_search_thread_entry (void* arg)
|
||||
{
|
||||
PBD::ThreadCreated (pthread_self(), X_("Freesound Search"));
|
||||
PBD::notify_gui_about_thread_creation (pthread_self(), X_("Freesound Search"));
|
||||
|
||||
static_cast<SoundFileBrowser*>(arg)->freesound_search_thread ();
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ Analyser::queue_source_for_analysis (boost::shared_ptr<Source> src, bool force)
|
|||
void
|
||||
Analyser::work ()
|
||||
{
|
||||
PBD::ThreadCreated (pthread_self(), string ("analyser-") + to_string (pthread_self(), std::dec));
|
||||
PBD::notify_gui_about_thread_creation (pthread_self(), string ("analyser-") + to_string (pthread_self(), std::dec));
|
||||
|
||||
while (true) {
|
||||
analysis_queue_lock.lock ();
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ _thread_init_callback (void *arg)
|
|||
knows about it.
|
||||
*/
|
||||
|
||||
PBD::ThreadCreatedWithRequestSize (pthread_self(), X_("Audioengine"), 4096);
|
||||
PBD::notify_gui_about_thread_creation (pthread_self(), X_("Audioengine"), 4096);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -302,7 +302,7 @@ OSC::get_unix_server_url()
|
|||
void *
|
||||
OSC::_osc_receiver(void * arg)
|
||||
{
|
||||
PBD::ThreadCreated (pthread_self(), X_("OSC"));
|
||||
PBD::notify_gui_about_thread_creation (pthread_self(), X_("OSC"));
|
||||
static_cast<OSC*> (arg)->osc_receiver();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ Session::wait_till_butler_finished ()
|
|||
void *
|
||||
Session::_butler_thread_work (void* arg)
|
||||
{
|
||||
PBD::ThreadCreated (pthread_self(), X_("Butler"));
|
||||
PBD::notify_gui_about_thread_creation (pthread_self(), X_("Butler"));
|
||||
return ((Session *) arg)->butler_thread_work ();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1155,7 +1155,7 @@ Session::midi_thread_work ()
|
|||
bool restart;
|
||||
vector<MIDI::Port*> ports;
|
||||
|
||||
PBD::ThreadCreatedWithRequestSize (pthread_self(), X_("MIDI"), 2048);
|
||||
PBD::notify_gui_about_thread_creation (pthread_self(), X_("MIDI"), 2048);
|
||||
|
||||
memset (&rtparam, 0, sizeof (rtparam));
|
||||
rtparam.sched_priority = 9; /* XXX should be relative to audio (JACK) thread */
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ std::list<boost::weak_ptr<AudioSource> > SourceFactory::files_with_peaks;
|
|||
static void
|
||||
peak_thread_work ()
|
||||
{
|
||||
PBD::ThreadCreated (pthread_self(), string ("peakbuilder-") + to_string (pthread_self(), std::dec));
|
||||
PBD::notify_gui_about_thread_creation (pthread_self(), string ("peakbuilder-") + to_string (pthread_self(), std::dec));
|
||||
|
||||
while (true) {
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ AbstractUI<RequestObject>::AbstractUI (string name, bool with_signal_pipes)
|
|||
throw failed_constructor();
|
||||
}
|
||||
|
||||
PBD::ThreadCreated.connect (mem_fun (*this, &AbstractUI<RequestObject>::register_thread));
|
||||
PBD::ThreadLeaving.connect (mem_fun (*this, &AbstractUI<RequestObject>::unregister_thread));
|
||||
PBD::ThreadCreatedWithRequestSize.connect (mem_fun (*this, &AbstractUI<RequestObject>::register_thread_with_request_count));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,9 +35,11 @@ void pthread_exit_pbd (void* status);
|
|||
std::string pthread_name ();
|
||||
|
||||
namespace PBD {
|
||||
extern sigc::signal<void,pthread_t,std::string> ThreadCreated;
|
||||
extern sigc::signal<void,pthread_t> ThreadLeaving;
|
||||
extern sigc::signal<void,pthread_t,std::string,uint32_t> ThreadCreatedWithRequestSize;
|
||||
extern void notify_gui_about_thread_creation (pthread_t, std::string, int requests = 256);
|
||||
extern void notify_gui_about_thread_exit (pthread_t);
|
||||
|
||||
extern sigc::signal<void,pthread_t> ThreadLeaving;
|
||||
extern sigc::signal<void,pthread_t,std::string,uint32_t> ThreadCreatedWithRequestSize;
|
||||
}
|
||||
|
||||
#endif /* __pbd_pthread_utils__ */
|
||||
|
|
|
|||
|
|
@ -30,15 +30,31 @@ using namespace std;
|
|||
typedef std::map<string,pthread_t> ThreadMap;
|
||||
static ThreadMap all_threads;
|
||||
static pthread_mutex_t thread_map_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
static pthread_mutex_t gui_notify_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
namespace PBD {
|
||||
sigc::signal<void,pthread_t,std::string> ThreadCreated;
|
||||
sigc::signal<void,pthread_t> ThreadLeaving;
|
||||
sigc::signal<void,pthread_t,std::string,uint32_t> ThreadCreatedWithRequestSize;
|
||||
}
|
||||
|
||||
using namespace PBD;
|
||||
|
||||
void
|
||||
PBD::notify_gui_about_thread_creation (pthread_t thread, std::string str, int request_count)
|
||||
{
|
||||
pthread_mutex_lock (&gui_notify_lock);
|
||||
ThreadCreatedWithRequestSize (thread, str, request_count);
|
||||
pthread_mutex_unlock (&gui_notify_lock);
|
||||
}
|
||||
|
||||
void
|
||||
PBD::notify_gui_about_thread_exit (pthread_t thread)
|
||||
{
|
||||
pthread_mutex_lock (&gui_notify_lock);
|
||||
ThreadLeaving (thread);
|
||||
pthread_mutex_unlock (&gui_notify_lock);
|
||||
}
|
||||
|
||||
int
|
||||
pthread_create_and_store (string name, pthread_t *thread, pthread_attr_t *attr, void * (*start_routine)(void *), void * arg)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -49,10 +49,9 @@ BasicUI::~BasicUI ()
|
|||
void
|
||||
BasicUI::register_thread (std::string name)
|
||||
{
|
||||
PBD::ThreadCreated (pthread_self(), name);
|
||||
PBD::notify_gui_about_thread_creation (pthread_self(), name);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BasicUI::access_action ( std::string action_path )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1029,7 +1029,7 @@ TranzportControlProtocol::monitor_work ()
|
|||
uint8_t offline = 0;
|
||||
|
||||
|
||||
PBD::ThreadCreated (pthread_self(), X_("Tranzport"));
|
||||
PBD::notify_gui_about_thread_creation (pthread_self(), X_("Tranzport"));
|
||||
pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, 0);
|
||||
pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, 0);
|
||||
next_track ();
|
||||
|
|
|
|||
|
|
@ -41,8 +41,7 @@ bool MackieControlProtocol::probe()
|
|||
|
||||
void * MackieControlProtocol::monitor_work()
|
||||
{
|
||||
// What does ThreadCreatedWithRequestSize do?
|
||||
PBD::ThreadCreated (pthread_self(), X_("Mackie"));
|
||||
PBD::notify_gui_about_thread_creation (pthread_self(), X_("Mackie"));
|
||||
|
||||
pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, 0);
|
||||
pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, 0);
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ TranzportControlProtocol::monitor_work ()
|
|||
bool first_time = true;
|
||||
uint8_t offline = 0;
|
||||
|
||||
PBD::ThreadCreated (pthread_self(), X_("Tranzport"));
|
||||
PBD::notify_gui_about_thread_creation (pthread_self(), X_("Tranzport"));
|
||||
pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, 0);
|
||||
pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, 0);
|
||||
rtpriority_set();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue