4 ms·
Side topic : The event loop architecture is also heavily used in iOS / Cocoa, although it is often not well understood by developper. Each thread has an event
by bsaul 9y ago
Side topic :
The event loop architecture is also heavily used in iOS / Cocoa, although it is often not well understood by developper. Each thread has an event loop, including the main UI thread, and many weird behaviors can be understood better once you know a bit about them.
Which made me wonder if a simple implementation of agent based concurrency in swift server couldn't simply be one agent - one event loop, plus a way to prevent direct calls across agent boundaries. Server is not iOS, but i suppose some language facilities should already be there and make it easier to implement.
/side topic
- pacaro 9y agoAlso win32/16 and X both have event loops at the core
- toast0 9y agoXlib has an event loop at the core, but if you write your client directly to the socket protocol, you can arrange it however you like.
- pacaro 9y agoYou could probably do the same with PeekMessage in win32, maybe call it periodically in a green threading library, or similar. But the most common mechanism is an event loop. I'm sure people have developed X applications that talk the protocol directly, but it isn't the typical way to do it.
- Matthias247 9y agoThe interesting question is more or less which GUI frameworks are not build around a singlethreaded event loop. QT and GTK/glib are too. Adobe AIR too. I think the Java frameworks (AWT, Swing) also.
- bschwindHN 9y agoAndroid also has event loops at its core but the Android API seems to do a pretty crappy job at exposing it in a nice way.