<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED DUPLICATE - Wayland may have interface bug when multi-threads programing."
href="https://bugs.freedesktop.org/show_bug.cgi?id=91750#c5">Comment # 5</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED DUPLICATE - Wayland may have interface bug when multi-threads programing."
href="https://bugs.freedesktop.org/show_bug.cgi?id=91750">bug 91750</a>
from <span class="vcard"><a class="email" href="mailto:ppaalanen@gmail.com" title="Pekka Paalanen <ppaalanen@gmail.com>"> <span class="fn">Pekka Paalanen</span></a>
</span></b>
<pre>(In reply to Jonas Ã…dahl from <a href="show_bug.cgi?id=91750#c4">comment #4</a>)
<span class="quote">> The difference to your example below is the wl_display_prepare_read(display)
> before creating the proxy, and wl_display_cancel_read(display) after setting
> the queue. The effect is that the other thread will not dispatch it, since
> it will only the dispatch events on the queue associated with it.
>
> Now, wl_display_roundtrip_queue() is a function that currently exposes the
> bug, but I'm not sure what unforseen side effects would be to add a
> work-around like the above, and whether it is a good idea to do it. The
> obvious side effect would be stalling other dispatcher threads a bit more
> than before.
>
> Pekka, any opinions whether we should temporarly "fix"
> wl_display_roundtrip_queue() until we introduce some new API?</span >
It would only fix the roundtrip and none of the other problems. IMHO it would
be a wasted effort, time would be better spent solving the underlying problem.
Using wl_display_prepare_read() is problematic, because it requires the
wl_event_queue to be empty. You need a dispatch loop to drain the
wl_event_queue until prepare_read() succeeds. Maybe that is not *that* bad
since wl_display_roundtrip_queue() *is* a dispatching function.
However, wl_display_roundtrip_queue() explicitly documents itself to be
incompatible with prepare_read() because roundtrip_queue() uses
wl_display_dispatch_queue(). I really do not want to review whether we could
break that rule in this specific case or not.
Because of the above, using wl_display_roundtrip{,_queue}() in a program using
the same wl_display from multiple threads is a mistake to begin with.
All this makes me wonder if we could rewrite the roundtrip functions on top the
prepare_read() API, and just deprecate wl_display_dispatch{,_queue}()
completely. Multi-threaded programs using
wl_display_dispatch{,_queue}() are broken to start with, and single-threaded
programs using wl_display_dispatch{,_queue}() cannot use the mutually exclusive
APIs at the same time by definition.
Yes, Mesa EGL Wayland platform implementation is broken. It uses
wl_display_dispatch_queue().</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>