diff options
| author | Jonas Ådahl <jadahl@gmail.com> | 2016-04-29 19:30:22 +0800 |
|---|---|---|
| committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2016-04-29 15:58:23 +0300 |
| commit | 6d29c0da3cd168e08187cd204d2314188479c0f1 (patch) | |
| tree | 3466c77ec6da0f2fb24d16fa17d1e7da4e77a0e5 /src/wayland-client-core.h | |
| parent | client: Make proxy_destroy a static function (diff) | |
| download | wayland-6d29c0da3cd168e08187cd204d2314188479c0f1.tar wayland-6d29c0da3cd168e08187cd204d2314188479c0f1.tar.gz wayland-6d29c0da3cd168e08187cd204d2314188479c0f1.tar.bz2 wayland-6d29c0da3cd168e08187cd204d2314188479c0f1.tar.lz wayland-6d29c0da3cd168e08187cd204d2314188479c0f1.tar.xz wayland-6d29c0da3cd168e08187cd204d2314188479c0f1.tar.zst wayland-6d29c0da3cd168e08187cd204d2314188479c0f1.zip | |
client: Introduce proxy wrappers
Using the libwayland-client client API with multiple threads with
thread local queues are prone to race conditions.
The problem is that one thread can read and queue events after another
thread creates a proxy but before it sets the queue.
This may result in the event to the proxy being silently dropped, or
potentially dispatched on the wrong thread had the creating thread set
the implementation before setting the queue.
This patch introduces API to solve this case by introducing "proxy
wrappers". In short, a proxy wrapper is a wl_proxy struct that will
never itself proxy any events, but may be used by the client to set a
queue, and use it instead of the original proxy when sending requests
that creates new proxies. When sending requests, the wrapper will
work in the same way as the normal proxy object, but the proxy created
by sending a request (for example wl_display.sync) will inherit to the
same proxy queue as the wrapper.
https://bugs.freedesktop.org/show_bug.cgi?id=91273
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Diffstat (limited to 'src/wayland-client-core.h')
| -rw-r--r-- | src/wayland-client-core.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/wayland-client-core.h b/src/wayland-client-core.h index 91f7e7b..b1d6515 100644 --- a/src/wayland-client-core.h +++ b/src/wayland-client-core.h @@ -132,6 +132,12 @@ struct wl_proxy * wl_proxy_create(struct wl_proxy *factory, const struct wl_interface *interface); +void * +wl_proxy_create_wrapper(void *proxy); + +void +wl_proxy_wrapper_destroy(void *proxy_wrapper); + struct wl_proxy * wl_proxy_marshal_constructor(struct wl_proxy *proxy, uint32_t opcode, |
