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:
Paul Davis 2008-11-06 22:18:27 +00:00
parent d410d82ad8
commit 99aad0d4df
19 changed files with 38 additions and 23 deletions

View file

@ -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)
{