summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-02-03 16:24:03 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-02-03 16:24:03 +0000
commita7b53d41ac1d6d879be0059140d481141d821be3 (patch)
treec45a7e4fafe3d0e658bedc4a8b524b954472d338 /libs
parent6b84d000a2e5d8102ad15ace303396a4eeaf29d1 (diff)
more fixes for any and all LV2 UI thread schemes
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@8690 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/pbd/pbd/abstract_ui.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/libs/pbd/pbd/abstract_ui.cc b/libs/pbd/pbd/abstract_ui.cc
index bc33fc9a39..6ea8d2b940 100644
--- a/libs/pbd/pbd/abstract_ui.cc
+++ b/libs/pbd/pbd/abstract_ui.cc
@@ -1,4 +1,5 @@
#include <unistd.h>
+#include <cstdlib>
#include <pbd/abstract_ui.h>
#include <pbd/pthread_utils.h>
@@ -30,10 +31,24 @@ AbstractUI<RequestObject>::register_thread (pthread_t thread_id, string name)
template <typename RequestObject> void
AbstractUI<RequestObject>::register_thread_with_request_count (pthread_t thread_id, string thread_name, uint32_t num_requests)
{
+ RequestBuffer* rbuf = static_cast<RequestBuffer*>(pthread_getspecific (thread_request_buffer_key));
+
+ /* we require that the thread being registered is the caller */
+
+ if (thread_id != pthread_self()) {
+ cerr << "thread attempts to register some other thread with the UI named " << name() << endl;
+ abort ();
+ }
+
+ if (rbuf) {
+ /* this thread is already registered with this AbstractUI */
+ return;
+ }
+
RequestBuffer* b = new RequestBuffer (num_requests);
{
- Glib::Mutex::Lock lm (request_buffer_map_lock);
+ Glib::Mutex::Lock lm (request_buffer_map_lock);
request_buffers[thread_id] = b;
}