<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Setting a queue on a wl_proxy is racy if some other thread is dispatching the default queue"
href="https://bugs.freedesktop.org/show_bug.cgi?id=91273#c12">Comment # 12</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Setting a queue on a wl_proxy is racy if some other thread is dispatching the default queue"
href="https://bugs.freedesktop.org/show_bug.cgi?id=91273">bug 91273</a>
from <span class="vcard"><a class="email" href="mailto:jadahl@gmail.com" title="Jonas Ådahl <jadahl@gmail.com>"> <span class="fn">Jonas Ådahl</span></a>
</span></b>
<pre>(In reply to Boram from <a href="show_bug.cgi?id=91273#c11">comment #11</a>)
<span class="quote">> > All threads call wl_display_read_events() after returning from poll(), but
> > only the last thread reads the data from the fd. That way we make sure all
> > threads who called wl_display_prepare_read_queue() will come out of poll
> > before we read the data.
>
> In multi-thread application, looks we need to avoid to use
> dispatch()/dipatch_queue(). And there might be no problem if every threads
> call prepare_read(), poll() and read_events(). For toolkits to support
> multi-thread, they also need to be fixed to use prepare_read/read_events, as
> well as mesa Pekka Paalanen mentioned above.
>
> To replace roundtrip()/dispatch()/dispatch_queue(), can wayland offer a new
> convenient API which internally calls poll() and read_events()? i.e,
> wl_display_poll_read()? It will be more convenient than calling poll() and
> read_events() directly by each library.</span >
It is more or less fine to use dispatch()/dispatch_queue() in a multi-threaded
application as long as one deals with tear-down appropriately and dispatches
the right queue on the right thread. See <a class="bz_bug_link
bz_status_NEW "
title="NEW - wl_display_dispatch(_queue) documentation about thread safeness is probably wrong"
href="show_bug.cgi?id=91767">bug 91767</a> and <a class="bz_bug_link
bz_status_NEW "
title="NEW - Meta bug for libwayland-client threading issues"
href="show_bug.cgi?id=91769">bug 91769</a> for more
details.
We aim to fix these issues shortly after the coming release.</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>