https://bugs.freedesktop.org/show_bug.cgi?id=91767
--- Comment #2 from Marek Chalupa <[email protected]> --- (In reply to Jonas Ã…dahl from comment #0) > There is documentation about wl_display_dispatch() states one may not mix > wl_display_dispatch(_queue) with wl_display_prepare_read() and friends, but > this is probably a common misconception, because internally, > wl_display_dispatch_queue() is implemented in the same way as one would use > wl_display_prepare_read() and friends, just without using those functions. > > I have patches in progress that changes wl_display_dispatch_queue() to > simply use wl_display_prepare_read() and related API internally to make this > more obvious. I forgot not only the details :) But looking into the code... Clearly you cannot do something like: wl_display_prepare_read() wl_display_dispatch() in one thread, that would leak to dead-lock. You're right that the wl_display_dispatch() works on the same basis as the prepare+read API. I think that they should not be mixed for the same reason you cannot call wl_display_dispatch_queue() from more threads. That is, there is (probably) no dead-lock, but thread can get sleeping with events queued. http://cgit.freedesktop.org/wayland/wayland/tree/src/wayland-client.c#n1454 If you call prepare + poll + read in thread A and wl_display_dispatch_queue() in another thread B (dispatching two different queues), the fd could become readable before wl_display_dispatch_queue() calls poll (http://cgit.freedesktop.org/wayland/wayland/tree/src/wayland-client.c#n1574) and whole prepare+read sequence could run before it, queing events into both queues. After prepare+read queued events, thread B goes to sleep in poll with events hanging in the queue. Avoiding this behaviour was why wl_display_prepare_read() and wl_display_read_events() API was added and why programs dispatching events from more threads should use it, while programs with single dispatcher thread can use the usual wl_display_dispatch_...() Implementing wl_display_dispatch(_queue) using prepare+read should fix this IMHO. -- You are receiving this mail because: You are the assignee for the bug.
_______________________________________________ wayland-bugs mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/wayland-bugs
