ObjFW  View Ticket

Ticket UUID: 31d9fb57cc9a777a67dd60bfc14462f838ed42f9
Title: OFRunLoop: Only use OFKernelEventObserver if we have sockets
Status: Open Type: Nice To Have
Severity: Important Priority: Medium
Subsystem: Resolution: Open
Last Modified: 2024-05-24 21:24:04
Version Found In: Milestone: 1.2
User Comments:
js added on 2020-06-22 00:37:54:

OFRunLoop currently always uses OFKernelEventObserver if ObjFW is compiled with support for sockets and OFKernelEventObserver initializes the network in its +[initialize]. On some systems (e.g. Wii), initializing the network takes quite a while, resulting in quite a lengthy startup time when the main run loop is initialized.

It would be much better to only initialize OFKernelEventObserver once a socket is added to the run loop, and always fall back to using conditions until a socket is added. At which point sockets are already initialized anyway and select() and similar are available.

This could even be improved further on some systems by asynchronously initializing sockets: Sockets initialization could be started asynchronously early on, and the synchronous sockets initialization used by many classes could then just wait for the async initialization to be done. This would allow to have all non-socket code running without delay, and possibly sockets already being initialized by the time the application wants to use them, instead of only starting initialization once the application wants to use sockets.

js added on 2023-07-15 14:52:14:

This has Type: Nice_To_Have, so shouldn't block the 1.0 release.