[PATCH] client: Add acquire-fd API to avoid requiring a polling main thread
Bill Spitzak
spitzak at gmail.com
Wed Apr 10 16:25:35 PDT 2013
Kristian Høgsberg wrote:
> This patch introduces new API to solve both problems. We add
>
> int wl_display_acquire_fd(struct wl_display *display);
I'm a little confused, some sample source code showing where the acquire
call goes would help. My guess is each thread should do this:
wl_display_acquire_fd(display);
for (;;) {
wl_display_dispatch_pending(display);
poll(fds, nfds, -1);
wl_display_dispatch(display);
if (needToDoExpensiveCalculation) {
wl_display_release_fd(display);
doExpensiveCalculation();
wl_display_acquire_fd(display);
}
}
This is based on reading the patch. The description made it sound like
dispatch() drops the lock, but it actually drops & regains it, right?
Also it is very unclear what to do if acquire returns EBUSY. The only
thing that looks like it will work is to busy-loop until it works?
More information about the wayland-devel
mailing list