X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fpbd%2Fpbd%2Fabstract_ui.cc;h=d43bc64f6352a8e3071a6cbc525cdf89eebde418;hb=54bf06e63cee78dfa218f604d862e577d0f5754c;hp=b300a62dd8e780e0d260e2750c1f2a7a64f1b5d1;hpb=d5e14b3d9144400fb8026fb9783a5a8582c0ad87;p=ardour.git diff --git a/libs/pbd/pbd/abstract_ui.cc b/libs/pbd/pbd/abstract_ui.cc index b300a62dd8..d43bc64f63 100644 --- a/libs/pbd/pbd/abstract_ui.cc +++ b/libs/pbd/pbd/abstract_ui.cc @@ -1,3 +1,22 @@ +/* + Copyright (C) 2012 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + #include #include @@ -11,9 +30,6 @@ using namespace std; -template -Glib::StaticPrivate::RequestBuffer> AbstractUI::per_thread_request_buffer; - template void cleanup_request_buffer (void* ptr) { @@ -28,11 +44,14 @@ cleanup_request_buffer (void* ptr) { - Glib::Mutex::Lock lm (rb->ui.request_buffer_map_lock); + Glib::Threads::Mutex::Lock lm (rb->ui.request_buffer_map_lock); rb->dead = true; } } +template +Glib::Threads::Private::RequestBuffer> AbstractUI::per_thread_request_buffer (cleanup_request_buffer::RequestBuffer>); + template AbstractUI::AbstractUI (const string& name) : BaseUI (name) @@ -87,7 +106,7 @@ AbstractUI::register_thread (string target_gui, pthread_t thread_ only at thread initialization time, not repeatedly, and so this is of little consequence. */ - Glib::Mutex::Lock lm (request_buffer_map_lock); + Glib::Threads::Mutex::Lock lm (request_buffer_map_lock); request_buffers[thread_id] = b; } @@ -100,7 +119,7 @@ AbstractUI::register_thread (string target_gui, pthread_t thread_ dead. it will then be deleted during a call to handle_ui_requests() */ - per_thread_request_buffer.set (b, cleanup_request_buffer); + per_thread_request_buffer.set (b); } template RequestObject* @@ -209,7 +228,7 @@ AbstractUI::handle_ui_requests () /* and now, the generic request buffer. same rules as above apply */ - Glib::Mutex::Lock lm (request_list_lock); + Glib::Threads::Mutex::Lock lm (request_list_lock); while (!request_list.empty()) { RequestObject* req = request_list.front (); @@ -322,7 +341,7 @@ AbstractUI::send_request (RequestObject *req) single-reader/single-writer semantics */ DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 send heap request type %3\n", name(), pthread_self(), req->type)); - Glib::Mutex::Lock lm (request_list_lock); + Glib::Threads::Mutex::Lock lm (request_list_lock); request_list.push_back (req); }