wl_buffer is not released for long time.

Pekka Paalanen ppaalanen at gmail.com
Fri Mar 16 10:14:52 UTC 2018


On Thu, 15 Mar 2018 15:44:18 +0000
Sichem Zhou <sichem.zh at gmail.com> wrote:

> Hi,
> 
> Sorry for the trouble, I forgot to ask that is it safe to call
> `wl_display_flush` and `wl_display_dispatch` in different threads?

Hi,

if you use threads, then you need to be using the prepare_read API of
libwayland-client. See the documentation for
wl_display_prepare_read_queue():
https://wayland.freedesktop.org/docs/html/apb.html#Client-classwl__display_1a40039c1169b153269a3dc0796a54ddb0

There is an example of the code sequence you must use in every thread,
that touches the wl_display or any wl object and needs to call poll()
or equivalent manually.

Please see the documentation of wl_display_dispatch() to see if you can
use it.

For every thread that dispatches events you will also need a separate
wl_event_queue, and you need to assign the wl objects to the correct
event queue unless the inherited event queue is already correct. For
assigning to a different event queue, you need to use
wl_proxy_create_wrapper() to avoid a race.

It is safe to call wl_display_flush() from different threads, but you
still need to ensure that it is really called before you expect poll()
to return with new events. This will be a concern if you send requests
from a thread that will not poll().


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20180316/246e55f1/attachment.sig>


More information about the wayland-devel mailing list