Wed Aug 19 12:31:08 EDT 2020
If time is a parameter, use condition variables
I'm honing in on the core problem:
If the algorithm is strongly parameterized by time or time
differences, it might make more sense to use conditions. E.g. do not
invert the handling of time into events.
If otoh the algorithm is strongly reactional without too much
depedency on time, an event-based architecture makes a lot more sense.
Converting from one to the other is probably going to be painful, but
is not impossible.
It is however possible to do an intermediate optimization where the
poll loop is pruned. This requires some infrastructure where
notifications are added. If the polling is kept, notifications can
even be optimisitic: e.g. make it legal to notify without something