EPICS Controls 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  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: dynamic monitoring
From: "Jeff Hill" <[email protected]>
To: "'Patrick Thomas'" <[email protected]>
Cc: [email protected]
Date: Mon, 24 Jan 2011 09:13:48 -0700
The simplest approach might be to have a single thread with a main loop like
this. Threaded approaches certainly add complexity which might not be needed
in this situation.
       
static const double delay = 10.0
while ( true ) {
	List :: iterator chanIter = chanList.begin ();
	while (chanIter != chanList.end () ) {
		if ( chanIter->wereInterestedAndHaventSubscibed () ) {
			ca_create_subscription (...,&chanIter->subscr)
		}
		else if ( chanIter->weLostInterestAndAreSubscibed () ){
			ca_clear_susbscription ( chanIter->subscr );
		}	
	}
	ca_pend_event(delay);
}

Jeff
______________________________________________________
Jeffrey O. Hill           Email        [email protected]
LANL MS H820              Voice        505 665 1831
Los Alamos NM 87545 USA   FAX          505 665 5107

Message content: TSPA

With sufficient thrust, pigs fly just fine. However, this is
not necessarily a good idea. It is hard to be sure where they
are going to land, and it could be dangerous sitting under them
as they fly overhead. -- RFC 1925


> -----Original Message-----
> From: Patrick Thomas [mailto:[email protected]]
> Sent: Friday, January 21, 2011 6:38 PM
> To: Jeff Hill
> Cc: [email protected]
> Subject: Re: dynamic monitoring
> 
> Do you mean calling ca_pend_event(0) in the main program, and
> subscribing/unsubscribing in a separate thread? Is there an advantage to
> this?
> 
> On 1/21/2011 5:34 PM, Jeff Hill wrote:
> > Hi Patrick,
> >
> > The mechanism to start/stop a subscription is accessed via calls to
> > ca_create_subscription/ca_clear_susbscription. If you have a single
> threaded
> > application then you will need to start and stop the subscriptions from
> > within the main loop. Therefore, yes, that could be accomplished by
> calling
> > ca_pend_event with a finite timeout, deciding what subscriptions might
> be
> > needed, and calling ca_create_subscription/ca_clear_susbscription to
> start
> > stop the appropriate subscriptions - all of these actions in a loop.
> There
> > are of course many other, more complex, ways to schedule this including
> > changing to a preemptive callback mode application with multiple
> threads
> > (emphasis on complex) but of course a simple, minimal approach is often
> > just-a-fit for the design requirements.
> >
> > Jeff
> > ______________________________________________________
> > Jeffrey O. Hill           Email        [email protected]
> > LANL MS H820              Voice        505 665 1831
> > Los Alamos NM 87545 USA   FAX          505 665 5107
> >
> > Message content: TSPA
> >
> > With sufficient thrust, pigs fly just fine. However, this is
> > not necessarily a good idea. It is hard to be sure where they
> > are going to land, and it could be dangerous sitting under them
> > as they fly overhead. -- RFC 1925
> >
> >
> >> -----Original Message-----
> >> From: [email protected] [mailto:tech-talk-
> >> [email protected]] On Behalf Of Patrick Thomas
> >> Sent: Friday, January 21, 2011 6:01 PM
> >> To: [email protected]
> >> Subject: dynamic monitoring
> >>
> >> Hi,
> >>
> >> I was wondering what the best way is to dynamically monitor channels
> in
> >> C. That is to start and stop monitoring channels at run time. I
> >> currently have a program that connects to and attaches monitors to a
> >> predefined list of channels and then goes into a ca_pend_event(0),
> which
> >> blocks forever. Should I change this to a loop and specify a certain
> >> time period, i.e. ca_pend_event(1) and add or remove channels in that
> >> loop?
> >>
> >> Thank you for your time,
> >> Patrick



References:
dynamic monitoring Patrick Thomas
RE: dynamic monitoring Jeff Hill
Re: dynamic monitoring Patrick Thomas

Navigate by Date:
Prev: RE: Driver for ABC 1260 Neutron Detector / Dosimeter from Framework Scientific Rarback, Harvey M.
Next: Re: gensub to asub emmanuel_mayssat
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: dynamic monitoring Patrick Thomas
Next: gensub to asub emmanuel_mayssat
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·