The current implementation of TimerFd::read() assumes that we can always obtain the number of timer expirations somehow. The whole point of enabling TimerCancelOnSet however is to introduce a case where we don't get this number.
Right now this effectively means that the only way to use this flag is to wrap the read() call in catch_panic and treat the panic case as cancellation. Clearly, this is awful.
Idea: add read_cancelable() -> Option<u64>
The current implementation of
TimerFd::read()assumes that we can always obtain the number of timer expirations somehow. The whole point of enablingTimerCancelOnSethowever is to introduce a case where we don't get this number.Right now this effectively means that the only way to use this flag is to wrap the
read()call incatch_panicand treat the panic case as cancellation. Clearly, this is awful.Idea: add
read_cancelable() -> Option<u64>