<html>
<head>
<base href="https://bugzilla.gnome.org/" />
</head>
<body><span class="vcard"><a href="page.cgi?id=describeuser.html&login=ystreet00%40gmail.com" title="Matthew Waters (ystreet00) <ystreet00@gmail.com>"> <span class="fn">Matthew Waters (ystreet00)</span></a>
</span> changed
<a class="bz_bug_link
bz_status_NEW "
title="NEW - gdk/wayland: event source is not multi-thread aware"
href="https://bugzilla.gnome.org/show_bug.cgi?id=763852">bug 763852</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Attachment #324334 status</td>
<td>needs-work
</td>
<td>none
</td>
</tr>
<tr>
<td style="text-align:right;">Attachment #324334 is obsolete</td>
<td>
</td>
<td>1
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - gdk/wayland: event source is not multi-thread aware"
href="https://bugzilla.gnome.org/show_bug.cgi?id=763852#c10">Comment # 10</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - gdk/wayland: event source is not multi-thread aware"
href="https://bugzilla.gnome.org/show_bug.cgi?id=763852">bug 763852</a>
from <span class="vcard"><a href="page.cgi?id=describeuser.html&login=ystreet00%40gmail.com" title="Matthew Waters (ystreet00) <ystreet00@gmail.com>"> <span class="fn">Matthew Waters (ystreet00)</span></a>
</span></b>
<pre>Created <span class=""><a href="attachment.cgi?id=325118&action=diff" name="attach_325118" title="gdk/wayland: use the multi-thread safe wayland dispatching API">attachment 325118</a> <a href="attachment.cgi?id=325118&action=edit" title="gdk/wayland: use the multi-thread safe wayland dispatching API">[details]</a></span> <a href='review?bug=763852&attachment=325118'>[review]</a>
gdk/wayland: use the multi-thread safe wayland dispatching API
(In reply to Jonas Ã…dahl from <a href="show_bug.cgi?id=763852#c9">comment #9</a>)
<span class="quote">> Review of <span class="bz_obsolete"><a href="attachment.cgi?id=324334&action=diff" name="attach_324334" title="gdk/wayland: use the multi-thread safe wayland dispatching API">attachment 324334</a> <a href="attachment.cgi?id=324334&action=edit" title="gdk/wayland: use the multi-thread safe wayland dispatching API">[details]</a></span> <a href='review?bug=763852&attachment=324334'>[review]</a> [review]:
> ::: gdk/wayland/gdkeventsource.c
> @@ +58,3 @@
> + * wl_display_cancel_read() */
> + if (source->reading)
> + wl_display_cancel_read (display->wl_display);
>
> When will this actually happen? Anyway, if it is needed, we should cancel
> the read the first thing in this function, so that we don't leave this
> function without later polling the fd.</span >
It used to happen in earlier patch versions. I've replaced it with an assert
instead.
<span class="quote">> @@ +60,3 @@
> + wl_display_cancel_read (display->wl_display);
> +
> + while (wl_display_prepare_read (display->wl_display) != 0)
>
> I think we can just do if (wl_display_prepare_read (display->wl_display) !=
> 0) return TRUE; as it means we can already dispatch without polling.
>
> We also need to wl_display_prepare_read() on the potential return FALSE;
> path above (the first if statement in this function), so that we always have
> prepared for reading when we return FALSE.</span >
As in when one of the previous conditions returns FALSE? I took a different
approach by only reading in check() when source->reading is TRUE.
Also, I wasn't sure if the revents & IN condition before dispatch_pending()
would always succeed when preemptively returning TRUE from prepare_read() so I
removed that as well so we always dispatch regardless of revents state. I
think that's still safe with the other gdk conditions possibly returning TRUE
from prepare().
<span class="quote">> @@ +81,1 @@
> + if (source->display->event_pause_count > 0) {
>
> nit: { sholud go on its own line.</span >
Fixed
<span class="quote">> @@ +90,3 @@
> + {
> + if (wl_display_read_events (display_wayland->wl_display) < 0)
> + g_error ("Error reading events from display: %s", g_strerror
> (errno));
>
> I think it might be a good idea to either g_assert (source->reading) or
> g_return_if_fail (source->reading) before actually reading here.</span >
That fails as prepare can return FALSE without reading (as you pointed out
above). I took the opposite approach of only reading when source->reading is
TRUE as that's simpler and involves less state tracking.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>