Commits on Source (2)
-
Switch the event queue used to a dedicated event queue which will create its own thread, instead of using QOS parallel queues, which prevents mixing with non-VLC tasks and ensure tasks are ordered.
d9de65d1 -
The event reporting must happen one event at a time and never trigger behaviour not expected by the underlying application. It uses a custom runloop mode to ensure only the VLC aware code can use the runloop (and thus usually main thread) when reporting an event. It was ensured by calling CFRunLoopRunInMode until the runloop is stopped. But there were multiple undetected flaws in this: - CFRunLoopRunInMode will terminate (with timeout or finish) whenever one event have been processed, so it needs to be called in loop with the correct invariant. - CFRunLoopRunInMode with timeout=0 will exit even sooner if there are not events available. - CFRunLoopStop will interrupt CFRunLoopInMode only if it's actually running so there's an asynchronous design flaw where we try to stop the event loop from another thread without syncing with this event loop. This patch fixes those issues, though it adds some callback nightmares, by adding a new level of dispatch to the main CFRunLoop, which will be the one to call CFRunLoopStop on itself. Thus, the CFRunLoop must be in a running state when CFRunLoopStop is called. It also ensure that we don't leave the loop for another reason than calling CFRunLoopStop, eg. Timeout or Finish result code.
786e351a