Guest User

base_ui 1

a guest
Oct 29th, 2025
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.72 KB | None | 0 0
  1.  
  2. diff --git a/libs/pbd/base_ui.cc b/libs/pbd/base_ui.cc
  3. index b15a548cfa..5f95928122 100644
  4. --- a/libs/pbd/base_ui.cc
  5. +++ b/libs/pbd/base_ui.cc
  6. @@ -104,8 +104,8 @@ BaseUI::main_thread ()
  7. bool
  8. BaseUI::signal_running ()
  9. {
  10. - Glib::Threads::Mutex::Lock lm (_run_lock);
  11. - _running.signal ();
  12. + std::unique_lock<std::mutex> lm(_run_lock);
  13. + _running.notify_one();
  14.  
  15. return false; // don't call it again
  16. }
  17. @@ -120,9 +120,9 @@ BaseUI::run ()
  18. _main_loop = MainLoop::create (m_context);
  19. attach_request_source ();
  20.  
  21. - Glib::Threads::Mutex::Lock lm (_run_lock);
  22. + std::unique_lock<std::mutex> lm(_run_lock);
  23. _run_loop_thread = PBD::Thread::create (std::bind (&BaseUI::main_thread, this), string_compose ("UI:%1", event_loop_name ()));
  24. - _running.wait (_run_lock);
  25. + _running.wait(lm);
  26. }
  27.  
  28. void
  29. @@ -139,7 +139,7 @@ BaseUI::request_handler (Glib::IOCondition ioc)
  30. {
  31. /* check the request pipe */
  32.  
  33. - if (ioc & IO_IN) {
  34. + if (static_cast<int>(ioc) & static_cast<int>(Glib::IOCondition::IO_IN)) {
  35. request_channel.drain ();
  36.  
  37. /* there may been an error. we'd rather handle requests first,
  38. @@ -152,7 +152,7 @@ BaseUI::request_handler (Glib::IOCondition ioc)
  39. handle_ui_requests ();
  40. }
  41.  
  42. - if (ioc & ~(IO_IN|IO_PRI)) {
  43. + if (static_cast<int>(ioc) & ~(static_cast<int>(Glib::IOCondition::IO_IN)|static_cast<int>(Glib::IOCondition::IO_PRI))) {
  44. _main_loop->quit ();
  45. }
  46.  
  47.  
  48. diff --git a/libs/pbd/pbd/base_ui.h b/libs/pbd/pbd/base_ui.h
  49. index 23b35926f0..63e72808fd 100644
  50. --- a/libs/pbd/pbd/base_ui.h
  51. +++ b/libs/pbd/pbd/base_ui.h
  52. @@ -20,14 +20,27 @@
  53.  
  54. #pragma once
  55.  
  56. +#ifdef _WIN32
  57. +#ifndef NOMINMAX
  58. +#define NOMINMAX
  59. +#endif
  60. +#ifndef WIN32_LEAN_AND_MEAN
  61. +#define WIN32_LEAN_AND_MEAN
  62. +#endif
  63. +#ifdef ERROR
  64. +#undef ERROR
  65. +#endif
  66. +#endif
  67. +
  68. #include <string>
  69. #include <stdint.h>
  70.  
  71. #include <sigc++/slot.h>
  72. #include <sigc++/trackable.h>
  73.  
  74. -#include <glibmm/threads.h>
  75. #include <glibmm/main.h>
  76. +#include <mutex>
  77. +#include <condition_variable>
  78.  
  79. #include "pbd/libpbd_visibility.h"
  80. #include "pbd/crossthread.h"
  81. @@ -79,8 +92,8 @@ class LIBPBD_API BaseUI : public sigc::trackable, public PBD::EventLoop
  82. Glib::RefPtr<Glib::MainLoop> _main_loop;
  83. Glib::RefPtr<Glib::MainContext> m_context;
  84. PBD::Thread* _run_loop_thread;
  85. - Glib::Threads::Mutex _run_lock;
  86. - Glib::Threads::Cond _running;
  87. + std::mutex _run_lock;
  88. + std::condition_variable _running;
  89.  
  90. /* this signals _running from within the event loop,
  91. from an idle callback
Advertisement
Add Comment
Please, Sign In to add comment