<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#c7">Comment # 7</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:syjman@gmail.com" title="Yujie Shen <syjman@gmail.com>"> <span class="fn">Yujie Shen</span></a>
</span></b>
<pre>(In reply to Jonas Ã…dahl from <a href="show_bug.cgi?id=91750#c6">comment #6</a>)
<span class="quote">> Yujie: as indirectly stated by Pekka, my example was incomplete. You would
> also need to dispatch pending events before the
> wl_display_prepare_read(display) call. This makes it, ignoring error
> handling, more or less:
>
> wl_surface_attach();
> while (wl_display_prepare_read_queue(display, queue) < 0)
> wl_display_dispatch_queue_pending(display, queue);
> window->callback = wl_surface_frame(window->surface);
> wl_proxy_set_queue(window->callback,queue2);
> wl_callback_add_listener(window->callback, &frame_listener, window);
> wl_display_cancel_read(display);
> wl_surface_commit(window->surface);
>
> This has the side effect that events already in the queue will be always
> dispatched before the frame is requested. This may have unwanted effects, so
> please consider whether this is Ok in your architecture. If it is not, you
> need to make sure that the above code is done after all events on the queue
> has been dispatched.</span >
Thanks for your kindly help.
By adding
<span class="quote">>while (wl_display_prepare_read_queue(display, queue2) < 0)
> wl_display_dispatch_queue_pending(display, queue2);
>wl_surface_commit(window->surface);</span >
it works in my case.
but, I still don't understand why it requires the wl_event_queue to be empty??
I'm trying to summary the restrictions of wayland when multi-thread
programming.
May I know if you have any idea about it.</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>