Hi Jack,
Additional to Andrew's comments on initOnce(), here is my two cents:
1. The function for the thread "scanOnce" (shown as you type "epicsThreadShowAll" in the Linux IOC shell) is actually onceTask(), not scanOnce(). The scanOnce() is a global function which is called by many other routines including scanShutdown() in dbScan.c, recGblFwdLink() in EPICS_BASE/src/db/recGbl.c, etc.;
2. Inside the infinite loop in onceTask(), it waits for the epicsEvent "onceSem" which is issued from scanOnce() (epicsEventSignal(onceSem)). Once it gets "onceSem", it will process all records in the Ring buffer if the IOC is not being shutdown;
3. The whole chain works like this: scanShutdown() or recGblFwdLink() or ... --> scanOnce() --> epicsEventMustWait(onceSem) in onceTask() --> ...
HTH,
Yong
-----Original Message-----
From: tech-talk-bounces@aps.anl.gov [mailto:tech-talk-bounces@aps.anl.gov] On Behalf Of Andrew Johnson
Sent: Thursday, January 10, 2013 12:05 PM
To: tech-talk@aps.anl.gov
Subject: Re: dbScan.c: periodicTask( ), initOnce( ), ...
Hi Jack,
Eric answered Q1, I'll tackle Q2:
On 2013-01-10 Jack Smith wrote:
> 2. Why do we need initOnce( ) in scanInit( )?
The IOC initialization code calls scanInit() at the appropriate time during iocInit(), the purpose of which is to initialize the dbScan subsystem, i.e.
create data the structures it needs and start its threads. The three local routines initOnce(), initPeriodic() and initEvent() that scanInit() calls initialize the three different kinds of scan operation supported by the dbScan
subsystem: The initOnce() routine configures and starts the "scanOnce" thread,
initPeriodic() counts and configures (but doesn't actually start) the periodic scan threads, and initEvent() configures the "scanEvent" data structures.
HTH,
- Andrew
--
There is no such thing as a free lunch. When invited for lunch, it is best to check if you are there to eat, or to be eaten.
-- Clive Robinson
- References:
- dbScan.c: periodicTask( ), initOnce( ), ... Jack Smith
- Re: dbScan.c: periodicTask( ), initOnce( ), ... Andrew Johnson
- Navigate by Date:
- Prev:
Re: routing Andrew Johnson
- Next:
Re: medm build D Peter Siddons
- 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: dbScan.c: periodicTask( ), initOnce( ), ... Andrew Johnson
- Next:
duplicating process variables James F Ross
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
<2013>
|