diff options
| author | Kristian Høgsberg <krh@bitplanet.net> | 2012-10-08 13:53:47 -0400 |
|---|---|---|
| committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-10-10 20:59:00 -0400 |
| commit | 9fe75537ad207c1496e6d9be41a8f5af4b876506 (patch) | |
| tree | 418b2b6857f458bddbdf9ca9864310c690f6fa64 /src/connection.c | |
| parent | scanner: Generate client stubs for wl_display requests (diff) | |
| download | wayland-9fe75537ad207c1496e6d9be41a8f5af4b876506.tar wayland-9fe75537ad207c1496e6d9be41a8f5af4b876506.tar.gz wayland-9fe75537ad207c1496e6d9be41a8f5af4b876506.tar.bz2 wayland-9fe75537ad207c1496e6d9be41a8f5af4b876506.tar.lz wayland-9fe75537ad207c1496e6d9be41a8f5af4b876506.tar.xz wayland-9fe75537ad207c1496e6d9be41a8f5af4b876506.tar.zst wayland-9fe75537ad207c1496e6d9be41a8f5af4b876506.zip | |
Split the global registry into its own wl_registry object
The only way to make the global object listener interface thread safe is to
make it its own interface and make different listeners different wl_proxies.
The core of the problem is the callback we do when a global show up or
disappears, which we can't do with a lock held. On the other hand we can't
iterate the global list or the listener list without a lock held as new
globals or listeners may come and go during the iteration.
Making a copy of the list under the lock and then iterating after dropping
the lock wont work either. In case of the listener list, once we drop the
lock another thread may unregister a listener and destroy the callbackk
data, which means that when we eventually call that listener we'll pass it
free memory and break everything.
We did already solve the thread-safe callback problem, however. It's what
we do for all protocol events. So we can just make the global registry
functionality its own new interface and give each thread its own proxy.
That way, the thread will do its own callbacks (with no locks held) and
destroy the proxy when it's no longer interested in wl_registry events.
Diffstat (limited to 'src/connection.c')
0 files changed, 0 insertions, 0 deletions
