>>27752>Controlling the event loop isn't even useful most of the time.maybe it isn't useful for you
suppose you are writing a gui program for torrents. you have to use sockets, many of them at the same time, some as server and some as client, not all of them using the same protocol. you probably also want to use a libaio style event loop for reading files and doing integrity checks. and while doing all of this you want the program to stay responsive to user input. all of these things will alter with the interface tree (to move a progress bar, to show a download/upload speed, etc. etc.) so lets see the options if you concede the event loop solely to the gui:
a. using threads for everything else. in this case the gui event loop will have to use mutexes to make the tree and state thread-safe. the threads will have to block (killing performance) or poll and defer based on mutex availability, which would significantly increase the complexity and still hurt performance somewhat
b. adding an api to the gui loop to support all the mentioned io configurations, and then do the same with every possible use case. this is what most retained mode libraries do, it hurts modularity, separation of concerns, and code reusability. it adds a significant work load for both the programmer, who now has to cover all the possible use cases in a complex area that has little to do with graphical interfaces, and the user, that has to learn and adapt to the particularities of these ad-hoc wrappers. this also increases the complexity of things like error handling and partial deinitialization on error because you are doing everything inside callbacks. another thing it makes more complex, almost impractical, is testing, because it becomes harder to cleanly recreate test scenarios
I don't think you understand how ipc works. if you have a child process it still has to communicate with the parent, either through a pipe, socket, file, or some other interface. so you are back at square 1, and if anything, you have added some complexity to the event loop now (checking the child process status, etc.)
think about it this way, the gui event loop is by far the simplest one: it blocks on a single fd. there is no reason why this should appropriate control flow when it could be integrated into a more generalized form (polling a set of file descriptors, for example). you can still have fixed framerates and/or event-based rendering with an user event loop + you don't lose orthogonality, separation of concerns, performance, etc. im libraries already do this and they are easier to use than rm libraries, and easier to integrate into different scenarios. not to mention that the code becomes easier to read and overall better
tl;dr if you want to see what I mean just write a small telnet gui, first with gtk using the glib event loop, and then with xcb or xlib using your own event loop (the poll syscall, or threads + a thread safe event queue, or whatever else you choose)