g+
g+ Communities
Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <2013 Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <2013
<== Date ==> <== Thread ==>

Subject: Re: time drift in camonitor timestamps
From: Eric Norum <eric@norum.ca>
To: Jack Smith <jacksmithvent2009@gmail.com>
Cc: EPICS Tech-Talk <tech-talk@aps.anl.gov>
Date: Wed, 9 Jan 2013 10:50:31 -0800
It's the epicsEventWaitWithTimeout().  This allows the pause to be interrupted early in the case of IOC shutdown.


static void periodicTask(void *arg)
{
    periodic_scan_list *ppsl = (periodic_scan_list *)arg;

    epicsTimeStamp nextScan, now;
    double delay;

    taskwdInsert(0, NULL, NULL);
    epicsEventSignal(startStopEvent);

    epicsTimeGetCurrent(&nextScan);
    while (ppsl->scanCtl != ctlExit) {
        if (ppsl->scanCtl == ctlRun) scanList(&ppsl->scan_list);
        nextScan += ppsl->period;
        epicsTimeGetCurrent(&now);
        delay = epicsTimeDiffInSeconds(&nextScan, &now);
        if (delay <= 0.0) {
            ppsl->overrunCount++;
            delay = 0.01;
            epicsTimeGetCurrent(&nextScan);
        }
        epicsEventWaitWithTimeout(ppsl->loopEvent, delay);      <<<<===== Here's where the magic happens.
    }

    taskwdRemove(0);
    epicsEventSignal(startStopEvent);
}


On Jan 9, 2013, at 10:35 AM, Jack Smith <jacksmithvent2009@gmail.com> wrote:

> Wow, amazing! It seems Eric fixed the problem which has been known for
> 2.5 years.
> 
> A little bit off-topic question: when I look through periodicTask( )
> which is the thread created by spawnPeriodic() for individual
> corresponding scanning period, I don't see any kind of 'timer' to
> trigger scanList(&ppsl->scan_list). So, my question is  how scanList(
> ) is periodically called in periodicTask( ) and where the 'timer'
> thing is?
> 
> Thanks,
> 
> Jack
> 

-- 
Eric Norum
eric@norum.ca






References:
time drift in camonitor timestamps ibadillo
RE: time drift in camonitor timestamps Mark Rivers
Re: time drift in camonitor timestamps Michael Davidsaver
Re: time drift in camonitor timestamps inari badillo
Re: time drift in camonitor timestamps Ralph Lange
Re: time drift in camonitor timestamps Eric Norum
Re: time drift in camonitor timestamps Jack Smith

Navigate by Date:
Prev: Re: time drift in camonitor timestamps Jack Smith
Next: Re: time drift in camonitor timestamps Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <2013
Navigate by Thread:
Prev: Re: time drift in camonitor timestamps Jack Smith
Next: Re: time drift in camonitor timestamps Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <2013
ANJ, 09 Jan 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICSv4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·