EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  <20252026  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  <20252026 
<== Date ==> <== Thread ==>

Subject: RE: callbackRequestDelayed question
From: Mark Rivers via Core-talk <core-talk at aps.anl.gov>
To: Michael Davidsaver <mdavidsaver at gmail.com>, "Johnson, Andrew N." <anj at anl.gov>
Cc: "core-talk at aps.anl.gov" <core-talk at aps.anl.gov>
Date: Wed, 12 Nov 2025 22:14:45 +0000

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

 

Hi Mark,

 

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.


Replies:
Re: callbackRequestDelayed question Michael Davidsaver via Core-talk
Re: callbackRequestDelayed question Michael Davidsaver via Core-talk
References:
RE: callbackRequestDelayed question Mark Rivers via Core-talk
Re: callbackRequestDelayed question Michael Davidsaver via Core-talk
RE: callbackRequestDelayed question Mark Rivers via Core-talk
Re: callbackRequestDelayed question Michael Davidsaver via Core-talk

Navigate by Date:
Prev: Re: callbackRequestDelayed question Michael Davidsaver via Core-talk
Next: Re: callbackRequestDelayed question Michael Davidsaver via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  <20252026 
Navigate by Thread:
Prev: Re: callbackRequestDelayed question Michael Davidsaver via Core-talk
Next: Re: callbackRequestDelayed question Michael Davidsaver via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  <20252026 
ANJ, 12 Nov 2025 · Home · News · About · Talk · Base · Modules · Extensions ·
· Distributions · Download · Documents · Links · Licensing ·