Add a function for temporarily blocking event loop

This can be used to prevent the Win32 message loop from running while
there are plugins in some partially initialized state.
This commit is contained in:
Robbert van der Helm
2021-01-27 18:46:36 +01:00
parent 04d0ff0949
commit 72e29d044a
5 changed files with 89 additions and 9 deletions
+17
View File
@@ -32,6 +32,20 @@ class HostBridge {
public:
virtual ~HostBridge(){};
/**
* If a plugin instance returns `true` here, then the event loop should not
* be run. Some very specific plugins, like the T-RackS 5 plugins, will set
* up a Win32 timer in their constructor, but since the plugins are left in
* a partially initialized state until `effOpen()` has been called running
* the Win32 message loop before that time will trigger a race condition
* within those plugins. This is very much an issue with those plugins, but
* since this situation wouldn't occur on Windows we'll just have to work
* around it.
*
* @relates MainContext::async_handle_events
*/
virtual bool inhibits_event_loop() = 0;
/**
* Handle events until the plugin exits. The actual events are posted to
* `main_context` to ensure that all operations to could potentially
@@ -66,6 +80,9 @@ class HostBridge {
* specific situation that can cause a race condition in some plugins
* because of incorrect assumptions made by the plugin. See the dostring for
* `Vst2Bridge::editor` for more information.
*
* TODO: We can get rid of this now, since we no longer have any special
* handling here
*/
virtual void handle_win32_events() = 0;