Eric,
I've partially implemented a C++ wrapper around CA which
runs the CA client code in a separate thread in order to hide
the asynchronous "untidy bits" (passing control off to to the
CA library to handle callbacks, etc.) from the user, though
have not yet had the opportunity to test it. The one major
immediately discernable issue is how to communicate between
the threads without ultimately falling back to a polling loop
inside the CA thread.
My solution to this was the following:
(1) set up a callback for getting CA's fd's
(2) create a special fd. Call it fd_foo
(3) within the CA thread, select on all of CA's
file descriptors, as well as fd_foo
(4) when select returns, check to see if the active
file descriptor is fd_foo.
+ If so, then do whatever
CA stuff you want (e.g. add a monitor, unconnect
a chid, etc.).
+ If not, then pass off control to CA so that
it can do whatever work needs doing on the active
file descriptor.
(5) select again within the CA thread.
The whole point of this is to ensure that CA is in a stable
state before calling any of the client code. When a thread wants
to perform some CA task, it writes to fd_foo its thread ID, which
causes select() to return in the CA thread, which then yields
to the thread which initiated the whole sequence of events.
Unfortunately, I'm not the one to say authoritatively whether
or not this is the best approach, but hought I would at least
share the idea with you.
Best Regards,
Chris
--
Christopher A. Larrieu
Jefferson Laboratory
(757) 269-5097
- References:
- Channel Access Client library Eric Boucher
- Navigate by Date:
- Prev:
RE: Channel Access Client library Jeff Hill
- Next:
invitation to new discussion of java GUI's Chip Watson
- Index:
1994
1995
1996
1997
1998
<1999>
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
RE: Channel Access Client library Jeff Hill
- Next:
invitation to new discussion of java GUI's Chip Watson
- Index:
1994
1995
1996
1997
1998
<1999>
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|