mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 16:46:35 +01:00
move BaseUI::_name into EventLoop; rename access method in EventLoop as event_loop_name() to clarify usage
This commit is contained in:
parent
6b00ff6198
commit
f369f33955
4 changed files with 14 additions and 9 deletions
|
|
@ -47,10 +47,10 @@ uint64_t BaseUI::rt_bit = 1;
|
||||||
BaseUI::RequestType BaseUI::CallSlot = BaseUI::new_request_type();
|
BaseUI::RequestType BaseUI::CallSlot = BaseUI::new_request_type();
|
||||||
BaseUI::RequestType BaseUI::Quit = BaseUI::new_request_type();
|
BaseUI::RequestType BaseUI::Quit = BaseUI::new_request_type();
|
||||||
|
|
||||||
BaseUI::BaseUI (const string& str)
|
BaseUI::BaseUI (const string& loop_name)
|
||||||
: m_context(MainContext::get_default())
|
: EventLoop (loop_name)
|
||||||
|
, m_context(MainContext::get_default())
|
||||||
, run_loop_thread (0)
|
, run_loop_thread (0)
|
||||||
, _name (str)
|
|
||||||
, request_channel (true)
|
, request_channel (true)
|
||||||
{
|
{
|
||||||
base_ui_instance = this;
|
base_ui_instance = this;
|
||||||
|
|
@ -79,7 +79,7 @@ BaseUI::new_request_type ()
|
||||||
void
|
void
|
||||||
BaseUI::main_thread ()
|
BaseUI::main_thread ()
|
||||||
{
|
{
|
||||||
DEBUG_TRACE (DEBUG::EventLoop, string_compose ("%1: event loop running in thread %2\n", name(), pthread_name()));
|
DEBUG_TRACE (DEBUG::EventLoop, string_compose ("%1: event loop running in thread %2\n", event_loop_name(), pthread_name()));
|
||||||
set_event_loop_for_thread (this);
|
set_event_loop_for_thread (this);
|
||||||
thread_init ();
|
thread_init ();
|
||||||
_main_loop->get_context()->signal_idle().connect (sigc::mem_fun (*this, &BaseUI::signal_running));
|
_main_loop->get_context()->signal_idle().connect (sigc::mem_fun (*this, &BaseUI::signal_running));
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,11 @@ static void do_not_delete_the_loop_pointer (void*) { }
|
||||||
|
|
||||||
Glib::Threads::Private<EventLoop> EventLoop::thread_event_loop (do_not_delete_the_loop_pointer);
|
Glib::Threads::Private<EventLoop> EventLoop::thread_event_loop (do_not_delete_the_loop_pointer);
|
||||||
|
|
||||||
|
EventLoop::EventLoop (string const& name)
|
||||||
|
: _name (name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
EventLoop*
|
EventLoop*
|
||||||
EventLoop::get_event_loop_for_thread() {
|
EventLoop::get_event_loop_for_thread() {
|
||||||
return thread_event_loop.get ();
|
return thread_event_loop.get ();
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,6 @@ class LIBPBD_API BaseUI : public sigc::trackable, public PBD::EventLoop
|
||||||
Glib::Threads::Thread* event_loop_thread() const { return run_loop_thread; }
|
Glib::Threads::Thread* event_loop_thread() const { return run_loop_thread; }
|
||||||
bool caller_is_self () const { return Glib::Threads::Thread::self() == run_loop_thread; }
|
bool caller_is_self () const { return Glib::Threads::Thread::self() == run_loop_thread; }
|
||||||
|
|
||||||
std::string name() const { return _name; }
|
|
||||||
|
|
||||||
bool ok() const { return _ok; }
|
bool ok() const { return _ok; }
|
||||||
|
|
||||||
static RequestType new_request_type();
|
static RequestType new_request_type();
|
||||||
|
|
@ -107,7 +105,6 @@ class LIBPBD_API BaseUI : public sigc::trackable, public PBD::EventLoop
|
||||||
virtual void handle_ui_requests () = 0;
|
virtual void handle_ui_requests () = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string _name;
|
|
||||||
BaseUI* base_ui_instance;
|
BaseUI* base_ui_instance;
|
||||||
|
|
||||||
CrossThreadChannel request_channel;
|
CrossThreadChannel request_channel;
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
#ifndef __pbd_event_loop_h__
|
#ifndef __pbd_event_loop_h__
|
||||||
#define __pbd_event_loop_h__
|
#define __pbd_event_loop_h__
|
||||||
|
|
||||||
|
#include <string>
|
||||||
#include <boost/function.hpp>
|
#include <boost/function.hpp>
|
||||||
#include <boost/bind.hpp> /* we don't need this here, but anything calling call_slot() probably will, so this is convenient */
|
#include <boost/bind.hpp> /* we don't need this here, but anything calling call_slot() probably will, so this is convenient */
|
||||||
#include <glibmm/threads.h>
|
#include <glibmm/threads.h>
|
||||||
|
|
@ -41,7 +42,7 @@ namespace PBD
|
||||||
class LIBPBD_API EventLoop
|
class LIBPBD_API EventLoop
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EventLoop() {}
|
EventLoop (std::string const&);
|
||||||
virtual ~EventLoop() {}
|
virtual ~EventLoop() {}
|
||||||
|
|
||||||
enum RequestType {
|
enum RequestType {
|
||||||
|
|
@ -73,12 +74,14 @@ class LIBPBD_API EventLoop
|
||||||
virtual void call_slot (InvalidationRecord*, const boost::function<void()>&) = 0;
|
virtual void call_slot (InvalidationRecord*, const boost::function<void()>&) = 0;
|
||||||
virtual Glib::Threads::Mutex& slot_invalidation_mutex() = 0;
|
virtual Glib::Threads::Mutex& slot_invalidation_mutex() = 0;
|
||||||
|
|
||||||
|
std::string event_loop_name() const { return _name; }
|
||||||
|
|
||||||
static EventLoop* get_event_loop_for_thread();
|
static EventLoop* get_event_loop_for_thread();
|
||||||
static void set_event_loop_for_thread (EventLoop* ui);
|
static void set_event_loop_for_thread (EventLoop* ui);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Glib::Threads::Private<EventLoop> thread_event_loop;
|
static Glib::Threads::Private<EventLoop> thread_event_loop;
|
||||||
|
std::string _name;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue