[vlc-devel] [PATCH] wayland: xdg-shell: use roundtrip instead of dispatch

Rémi Denis-Courmont remi at remlab.net
Mon Apr 6 19:10:09 CEST 2020


Le maanantaina 6. huhtikuuta 2020, 19.50.52 EEST Alexandre Janniaux a écrit :
> When using wl_display_dispatch, there is a race condition with the main
> loop, in which the condition `(!sys->wm.configured)` would have been
> checked as true, but the event dispatched from the main thread after
> that so wl_display_dispatch would block indefinitely.
> 
> Said differently, wl_display_dispatch should not be called from a
> different thread than the main thread (in wayland terms).

That's a bit of code in that file that I did not write so I can believe that 
it's wrong :D but...

> By using wl_display_roundtrip, we let the main thread unblock the
> vout_window_Enable and prevent this deadlock.

I don't think you can call wl_display_roundtrip outside the main thread, once 
it is running.

The documentation says:
| This function uses wl_display_dispatch_queue() internally. It is not allowed
| to call this function while the thread is being prepared for reading events,
| and doing so will cause a dead lock.

-- 
Rémi Denis-Courmont
Ville neuve de Tapiola, République d´Uusimaa





More information about the vlc-devel mailing list