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  <20122013  2014  2015  2016  2017  2018  2019  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019 
<== Date ==> <== Thread ==>

Subject: Synchronising CA shut down
From: <michael.abbott@diamond.ac.uk>
To: <tech-talk@aps.anl.gov>
Date: Wed, 14 Mar 2012 13:08:28 +0000
When running libca with asynchronous and preemptive callbacks, ie, I've called

	ca_context_create(1)

is there any guarantee about when subscription callbacks can occur?

For instance, if I have called:

	ca_create_subscription( ... my_callback ..., &event_id)

and then subsequently call ca_clear_subscription(event_id) is there any guarantee that I can rely on that my_callback() cannot be in progress when ca_clear_subscription() returns?

The problem is, of course, one of resource management -- at what point is it safe to delete the resources associated with the channel and needed by my_callback()?


In an ideal world I would hope that ca_clear_subscription() would block until any outstanding callbacks (potentially running in other cores) had completed together with providing a guarantee that there would be no further callbacks ... but I'm guessing such hopes are unfounded?

Of course, the same question applies to calling ca_clear_channel() when there are outstanding put or get callbacks that might complete at a peculiarly inconvenient moment.

In the absence of such guarantees what can I do to reduce or eliminate potential race conditions when closing channels and subscriptions?  At the moment the only remedy I can think of is to wait a moment, not exactly the stuff of guarantees.


A quick glance at the code (in ca) seems to show that although there is an epicsGuard taken during ca_clear_subscription, as far as I can tell the guard is dropped during callbacks ... for understandable reasons.

-- 
This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. 
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
 





Replies:
RE: Synchronising CA shut down Hill, Jeffrey O

Navigate by Date:
Prev: Re: "Size of symbol changed" warnings building EPICS Base 3.14.12.2 Dirk Zimoch
Next: Re: iocshCmd, redirection, and function pointers Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019 
Navigate by Thread:
Prev: Re: iocshCmd, redirection, and function pointers Andrew Johnson
Next: RE: Synchronising CA shut down Hill, Jeffrey O
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019 
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 ·