Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/libs/pbd/base_ui.cc b/libs/pbd/base_ui.cc
- index b15a548cfa..5f95928122 100644
- --- a/libs/pbd/base_ui.cc
- +++ b/libs/pbd/base_ui.cc
- @@ -104,8 +104,8 @@ BaseUI::main_thread ()
- bool
- BaseUI::signal_running ()
- {
- - Glib::Threads::Mutex::Lock lm (_run_lock);
- - _running.signal ();
- + std::unique_lock<std::mutex> lm(_run_lock);
- + _running.notify_one();
- return false; // don't call it again
- }
- @@ -120,9 +120,9 @@ BaseUI::run ()
- _main_loop = MainLoop::create (m_context);
- attach_request_source ();
- - Glib::Threads::Mutex::Lock lm (_run_lock);
- + std::unique_lock<std::mutex> lm(_run_lock);
- _run_loop_thread = PBD::Thread::create (std::bind (&BaseUI::main_thread, this), string_compose ("UI:%1", event_loop_name ()));
- - _running.wait (_run_lock);
- + _running.wait(lm);
- }
- void
- @@ -139,7 +139,7 @@ BaseUI::request_handler (Glib::IOCondition ioc)
- {
- /* check the request pipe */
- - if (ioc & IO_IN) {
- + if (static_cast<int>(ioc) & static_cast<int>(Glib::IOCondition::IO_IN)) {
- request_channel.drain ();
- /* there may been an error. we'd rather handle requests first,
- @@ -152,7 +152,7 @@ BaseUI::request_handler (Glib::IOCondition ioc)
- handle_ui_requests ();
- }
- - if (ioc & ~(IO_IN|IO_PRI)) {
- + if (static_cast<int>(ioc) & ~(static_cast<int>(Glib::IOCondition::IO_IN)|static_cast<int>(Glib::IOCondition::IO_PRI))) {
- _main_loop->quit ();
- }
- diff --git a/libs/pbd/pbd/base_ui.h b/libs/pbd/pbd/base_ui.h
- index 23b35926f0..63e72808fd 100644
- --- a/libs/pbd/pbd/base_ui.h
- +++ b/libs/pbd/pbd/base_ui.h
- @@ -20,14 +20,27 @@
- #pragma once
- +#ifdef _WIN32
- +#ifndef NOMINMAX
- +#define NOMINMAX
- +#endif
- +#ifndef WIN32_LEAN_AND_MEAN
- +#define WIN32_LEAN_AND_MEAN
- +#endif
- +#ifdef ERROR
- +#undef ERROR
- +#endif
- +#endif
- +
- #include <string>
- #include <stdint.h>
- #include <sigc++/slot.h>
- #include <sigc++/trackable.h>
- -#include <glibmm/threads.h>
- #include <glibmm/main.h>
- +#include <mutex>
- +#include <condition_variable>
- #include "pbd/libpbd_visibility.h"
- #include "pbd/crossthread.h"
- @@ -79,8 +92,8 @@ class LIBPBD_API BaseUI : public sigc::trackable, public PBD::EventLoop
- Glib::RefPtr<Glib::MainLoop> _main_loop;
- Glib::RefPtr<Glib::MainContext> m_context;
- PBD::Thread* _run_loop_thread;
- - Glib::Threads::Mutex _run_lock;
- - Glib::Threads::Cond _running;
- + std::mutex _run_lock;
- + std::condition_variable _running;
- /* this signals _running from within the event loop,
- from an idle callback
Advertisement
Add Comment
Please, Sign In to add comment