> 3. Attach the file descriptor for the compositor's end of the pipe to > the compositor event loop, and eliminate the polling. > > Thus at the end of this, the renderer end of the Unix socket will be in > `libuv` land, and the compositor end will be in the OS's native event loop.
I like the overall design of this proposal much better than what we were thinking of doing previously to address polling (https://github.com/mozilla/servo/issues/588 ). Please correct me if I'm misunderstanding, but in this design we would still need to both receive Rust messages and process windowing messages in the compositor and on the same underlying OS thread (because of restrictions with touching windowing system objects from a non-UI/main thread). If so, then we'd have to do something to either unify those events or change the current code, with some obvious ideas being: 1) Have platform-specific code below the glfw/glut layer that has access to the raw UNIX X11 socket and pipe to call select on both / named pipe and window handle to call MsgWaitForMultipleObjectsEx on both / <whatever you do on OSX>. 2) Have two tasks, one waiting in windowing and one waiting on the pipe, with the ability for the pipe to "wake" the windowing thread so it knows to read a message queue via a hack windowing event ala the proposal in the issue above. 3) Change all of the code in the compositor that receives messages from the Renderer to be safe w.r.t. being called from a thread other than the OS thread. Did you have other ideas on how to handle this? Or, am I misunderstanding this part of the design? Apologies if it's obvious and libuv handles this directly - I didn't see anything in the libuv documentation or example sources. > Note that Google Chrome and Safari already do this (in Chrome's case, > with handwritten C++ code and a somewhat idiosyncratic event loop > abstraction). I don't expect our perf to be substantially worse. Is the reason for the idiosyncratic event loop code related to combining the multi-platform windowing wait and waiting on the pipe? Thanks for sharing this proposal, - Lars _______________________________________________ dev-servo mailing list [email protected] https://lists.mozilla.org/listinfo/dev-servo

