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