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  2011  2012  2013  <20142015  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  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Permissible in C to call CA I/O functions from callback?
From: Andrew Johnson <[email protected]>
To: <[email protected]>
Date: Fri, 7 Nov 2014 15:24:34 -0600
Hi Lewis,

On 11/07/2014 11:19 AM, J. Lewis Muir wrote:
> Thanks for the clarification.  One thing that's still unclear to me
> is the semantics of callback execution in preemptive mode.  In the CA
> reference manual section "Thread Safety and Preemptive Callback to User
> Code" it says,
> 
>   "When the CA client library invokes a user's callback function, it
>    will always wait for the current callback to complete prior to
>    executing another callback function."
> 
> What exactly does this mean in preemptive mode?

I don't know for sure myself, I was trying to understand that while
writing my previous response. I started out thinking that it would not
apply when preemptive callbacks are enabled, but after looking through
the code of the library now I'm less sure of that. This comment
                // only one recv thread at a time may call callbacks
                // - pendEvent() blocks until threads waiting for
                // this lock get a chance to run
quite strongly implies that even in preemptive mode the the library will
serialize all application callbacks, like you suggested:

> Or does the CA client library serialize the callback
> calling such that, regardless of how many threads the CA client library
> may have internally, it will still only call the on_state_change
> callback function serially (e.g. call it for the ch_nx change, wait for
> it to complete, then call it for the ch_ny change)?

That may have been done to allow sharing of chid objects between
application threads (in the same CA context) without having to protect
their contents with a local mutex say.

Jeff Hill would be able to answer definitively, but he isn't seen round
these parts very often nowadays.

- Andrew
-- 
People everywhere confuse what they read in newspapers with news.
-- A. J. Liebling

Replies:
Re: Permissible in C to call CA I/O functions from callback? Benjamin Franksen
References:
Permissible in C to call CA I/O functions from callback? J. Lewis Muir
Re: Permissible in C to call CA I/O functions from callback? Andrew Johnson
Re: Permissible in C to call CA I/O functions from callback? J. Lewis Muir
Re: Permissible in C to call CA I/O functions from callback? Andrew Johnson
Re: Permissible in C to call CA I/O functions from callback? J. Lewis Muir

Navigate by Date:
Prev: Polling CA client library in nonpreemptive mode at less than 10 Hz J. Lewis Muir
Next: Re: Polling CA client library in nonpreemptive mode at less than 10 Hz Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Permissible in C to call CA I/O functions from callback? J. Lewis Muir
Next: Re: Permissible in C to call CA I/O functions from callback? Benjamin Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 17 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·