On Wed, 11 Jul 2018 21:42:24 -0400 Sichem Zhou <sichem...@gmail.com> wrote:
> Hi All, > > I have a question related to the wl_client creation in the compositor. I > followed these step like weston did: > > 1. create socketpair. > 2. fork a process and close `socket[0]` in child, close `socket[1]` in in > parent process. > 3. set the `WAYLAND_SOCKET` to `socket[1]`. > 4. exec the program. > > I found out if I do this directly both compositor and client will stuck in > the eventloop. It seems the compositor is stuck in the > `wl_display_flush_clients` and client is stuck in `wl_event_queue_dispatch` > and internally stuck in the epoll. So I think both compositor and client > were waiting each other for some update. > > Then I found out that I need to pack the code in a > `wl_event_loop_idle_func_t` and add it to the event_loop. But I am couldn't > figure out why did the compositor stuck in the first place and why did the > wl_event_loop_add_idle helped. Hi, that's a good question. Weston launches most (all?) of it's own clients during init, and it uses the idle task to postpone the actual launch to after all immediate initializations have completed, so that the clients get launched once Weston is running its main event loop. I don't recall anything there that would cause a deadlock though. When the compositor is stuck, is it in an endless loop eating 100% CPU? If so, maybe (the client?) list gets corrupted. Stuck in a busyloop is often caused by list corruption. But again, I couldn't see how that would happen. There does not seem to be list traversal going while processing requests which might create a new client. (Modifying a list while it is being traversed is a bit tricky to get right.) I would be interested to hear if you figure it out. Thanks, pq
pgprgXS4I6kuq.pgp
Description: OpenPGP digital signature
_______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel