+/*
+ 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 <unistd.h>
#include <iostream>
using namespace std;
-template<typename R>
-Glib::StaticPrivate<typename AbstractUI<R>::RequestBuffer> AbstractUI<R>::per_thread_request_buffer;
-
template<typename RequestBuffer> void
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<typename R>
+Glib::Threads::Private<typename AbstractUI<R>::RequestBuffer> AbstractUI<R>::per_thread_request_buffer (cleanup_request_buffer<AbstractUI<R>::RequestBuffer>);
+
template <typename RequestObject>
AbstractUI<RequestObject>::AbstractUI (const string& name)
: BaseUI (name)
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;
}
dead. it will then be deleted during a call to handle_ui_requests()
*/
- per_thread_request_buffer.set (b, cleanup_request_buffer<RequestBuffer>);
+ per_thread_request_buffer.set (b);
}
template <typename RequestObject> RequestObject*
/* 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 ();
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);
}