microsoft / wifi-ztp

Wi-Fi Zero Touch Provisioning (ZTP)
MIT License
12 stars 4 forks source link

Replace custom event loop with open-source alternative #10

Open abeltrano opened 3 years ago

abeltrano commented 3 years ago

Is your feature request related to a problem? Please describe. The code to manage the event loop was written from scratch. During early development, there were not many event loop features that were needed, so a hand-written one allowed rapid prototyping. However, the event loop has become more complicated and so, it may be a better idea to replace the hand-written event loop code with a publicly available, well documented and tested event library.

Describe the solution you'd like The hand-written event code should be replaced with a well-tested, open-source event library for C. Many popular event libraries available, the following libraries are a good start for consideration:

Describe alternatives you've considered

Additional context

forwardpointer commented 3 years ago

I'll look into using libevent for this. It seems the most promising out of the three listed.

forwardpointer commented 3 years ago

Would sd-event be a viable option since we are already using libsystemd? It provides an event loop for events based on file IO, signals, and timers.

abeltrano commented 3 years ago

Would sd-event be a viable option since we are already using libsystemd? It provides an event loop for events based on file IO, signals, and timers.

Yes, sd-event looks like a great candidate and I can't see a reason why we would prefer the other alternatives over it, given our goals. If we needed to support non-Linux scenarios, it would be a different story, but this project is Linux specific, so not an issue here.

Looking at the sd-event implementation, it's very close to our own event loop so switching to it shouldn't change behavior much, if at all.