Marcel Wiesweg wrote:
There will be several cases where a plugin wants to access the main thread. There should be a clear and reliable mechanism to do this.
- access and possibly wake up the event loop
- an addressee
- possibility to store private data
- every request for access will result in exactly one access, as soon as
possible as soon as all other events have been processed
What about this approach: Secure most of the main loop with a spin lock, and release the lock before sleeping in the event loop. Before processing the next key event, lock again. By locking that spin lock, a thread can catch the main thread sleeping, and keep it sleeping until whatever non-threadsafe has been done. The user thread will not become main thread, but at least the main thread will not interfere.
However, this doesn't solve the popup problems, eg. a simple way to activate a cOsdObject without abuse of MainMenuAction.
Cheers,
Udo