Sun, Jan 22, 2023 at 02:52:03PM +0200, Marko Mäkelä wrote:
This code illustrates another limitation: There is no way to pass an absolute time to cCondVar::TimedWait(). On each call, a relative wake-up time (milliseconds from the current time) will be converted into an absolute time. If there was a way, we would be able to remove the "cTimeMs timer" and some related system calls, and have this loop both wake up every 100 milliseconds, and process events as soon as they arrive. Here is the VDR part of the patch:
At https://github.com/reufer/rpihddevice/pull/14#discussion_r1083466069 I posted an example of using an absolute variant of cCondVar::TimedWait(). The thread cOmx::Action() would perform some action every 100 milliseconds, and additionally consume m_portEvents as soon as events are enqueued by cOmx::Add() in another thread.
Marko