Hi Michael,
- I would love to remove that -quantum/2 . As you note, it causes timers to expire early. However, doing so caused problems on RTOSs, which I assume is still the case.
But more importantly for me callbackRequestDelayed returns immediately for all delays less than 10 ms. It’s hard to believe it is a coincidence that epicsThreadSleepQuantum() is 10 ms. It thus appears to
me that if the requested delay is less than epicsThreadSleepQuantum() then callbackRequestDelayed returns immediately. Is that true?
The most recent Application Developer’s Guide says this:
epicsTimerQueueNotify:: quantum
The virtual function epicsTimerQueueNotify::quantum() returns the timer expire interval scheduling quantum in seconds. This allows different types of timer queues to use application specific timer expire delay
scheduling policies. The implementation of epicsTimerQueueActive employs epicsThreadSleep() for this purpose, and therefore epicsTimerQueueActive::quantum() returns the returned value from epicsThreadSleepQuantum(). Other types of timer queues might choose
to schedule timer expiration using specialized hardware interrupts. In this case epicsTimerQueueNotify::quantum() might return a value reflecting the precision of a hardware timer. If unknown, then epicsTimerQueueNotify::quantum() should return zero.
Is it possible to override the value for epicsThreadSleepQuantum()?
Thanks,
Mark
From: Michael Davidsaver <mdavidsaver at gmail.com>
Sent: Wednesday, November 12, 2025 4:03 PM
To: Mark Rivers <rivers at cars.uchicago.edu>; Johnson, Andrew N. <anj at anl.gov>
Cc: core-talk at aps.anl.gov
Subject: Re: callbackRequestDelayed question
On 11/12/25 1:51 PM, Mark Rivers wrote:
Yes, but it appears from my results that EPICS timers are actually using the result of epicsThreadSleepQuantum() even though as you say it “has no
reality”.
timer.cpp: this->exp = expire - ( this->queue.notify.quantum () / 2.0 );
I would love to remove that -quantum/2 . As you note, it causes timers to expire early. However, doing so caused problems on RTOSs, which I assume is still the case.
https://bugs.launchpad.net/epics-base/+bug/1861612/comments/12
https://github.com/epics-base/epics-base/issues/106
(I have to admit that I have been patching this out of my builds for some time)
This is the result of a git grep -i for “quantum” in /usr/local/epics/base/modules/libcom/src/timer
timer.cpp: this->exp = expire - ( this->queue.notify.quantum () / 2.0 );
Filtering out the declarations and plumbing, I think this is the only remaining usage.