EPICS Home

Experimental Physics and Industrial Control System


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

Subject: RE: pv connect/disconnect callbacks
From: "Jeff Hill" <[email protected]>
To: "'john sinclair'" <[email protected]>, "'EPICS tech-talk'" <[email protected]>
Date: Wed, 11 Jan 2006 16:38:36 -0700
John,

The R3.14 version of the CA client library *does* execute callbacks from
auxiliary CA client library private threads. In contrast, the R3.13 CA
client library was scheduled with select() and all callbacks occurred in the
main thread.

With the R3.14 version of the CA client library we can specify one of two
operating modes, preemptive callback or non-preemptive callback (the
default), when creating a CA client context.

In non-preemptive callback mode special mechanisms are in place to prevent
callbacks from being delivered unless the thread that created the CA client
context (in your case probably the main thread) is executing inside of the
CA client library. This should be very close to indistinguishable from R3.13
behavior.

In preemptive callback mode callbacks are executed from auxiliary threads at
any time (as soon as they are ready to run).

PS: Its rare that you might need to do this, but if you need to hang thread
specific context on one of CA's auxiliary threads the first time that CA's
auxiliary thread calls one of your functions this can be accomplished easily
using routines in the EPICS OSI libraries. I can provide additional details
if you are interested.

Jeff

> -----Original Message-----
> From: john sinclair [mailto:[email protected]]
> Sent: Wednesday, January 11, 2006 4:00 PM
> To: EPICS tech-talk
> Subject: pv connect/disconnect callbacks
> 
> 
> Are channel callbacks delivered in the context of a different thread from
> that
> of main in a single-threaded application?
> 
> A disconnect callback backtrace looks like this:
> 
> #1  0x08129b96 in EPICS_ProcessVariable::ca_connect_callback (arg=
>       {chid = 0x982e390, op = 7}) at epics_pv_factory.cc:226
> #2  0x00fbf6ea in oldChannelNotify::disconnectNotify ()
>    from /epics/supTop/R3.14.5/base-3.14.5/lib/linux-x86/libca.so
> #3  0x00faeda8 in nciu::unresponsiveCircuitNotify ()
>    from /epics/supTop/R3.14.5/base-3.14.5/lib/linux-x86/libca.so
> #4  0x00fb86a3 in tcpiiu::removeAllChannels ()
>    from /epics/supTop/R3.14.5/base-3.14.5/lib/linux-x86/libca.so
> #5  0x00fa290d in cac::destroyIIU ()
>    from /epics/supTop/R3.14.5/base-3.14.5/lib/linux-x86/libca.so
> #6  0x00fb3680 in tcpSendThread::run ()
>    from /epics/supTop/R3.14.5/base-3.14.5/lib/linux-x86/libca.so
> #7  0x0015e55b in epicsThreadCallEntryPoint ()
>    from /epics/supTop/R3.14.5/base-3.14.5/lib/linux-x86/libCom.so
> #8  0x001640e9 in start_routine ()
>    from /epics/supTop/R3.14.5/base-3.14.5/lib/linux-x86/libCom.so
> #9  0x00bae98c in start_thread () from /lib/tls/libpthread.so.0
> #10 0x00a2f7da in clone () from /lib/tls/libc.so.6
> 
> A value change callback backtrace looks like this:
> 
> #0  XtextDspUpdate (pv=0x8cca3a8, userarg=0x8cc7da0) at
> x_text_dsp_obj.cc:1180
> #1  0x0812832a in ProcessVariable::do_value_callbacks (this=0x8cca3a8)
>     at pv_factory.cc:415
> #2  0x08129d8d in EPICS_ProcessVariable::ca_value_callback (args=
>       {usr = 0x8cca3a8, chid = 0x8ccb6a0, type = 20, count = 1, dbr =
> 0x8cfefa8, status = 1}) at epics_pv_factory.cc:300
> #3  0x00445b7f in oldSubscription::current ()
>    from /epics/supTop/R3.14.5/base-3.14.5/lib/linux-x86/libca.so
> #4  0x0043fb58 in netSubscription::completion ()
>    from /epics/supTop/R3.14.5/base-3.14.5/lib/linux-x86/libca.so
> #5  0x0042403f in cac::eventRespAction ()
>    from /epics/supTop/R3.14.5/base-3.14.5/lib/linux-x86/libca.so
> #6  0x00428765 in cac::executeResponse ()
>    from /epics/supTop/R3.14.5/base-3.14.5/lib/linux-x86/libca.so
> #7  0x0043c81e in tcpiiu::processIncoming ()
>    from /epics/supTop/R3.14.5/base-3.14.5/lib/linux-x86/libca.so
> #8  0x00439fe6 in tcpRecvThread::run ()
>    from /epics/supTop/R3.14.5/base-3.14.5/lib/linux-x86/libca.so
> #9  0x0015e55b in epicsThreadCallEntryPoint ()
>    from /epics/supTop/R3.14.5/base-3.14.5/lib/linux-x86/libCom.so
> #10 0x001640e9 in start_routine ()
>    from /epics/supTop/R3.14.5/base-3.14.5/lib/linux-x86/libCom.so
> #11 0x00bae98c in start_thread () from /lib/tls/libpthread.so.0
> #12 0x00a2f7da in clone () from /lib/tls/libc.so.6
> 
> --
> John Sinclair



References:
pv connect/disconnect callbacks john sinclair

Navigate by Date:
Prev: pv connect/disconnect callbacks john sinclair
Next: About: timeout handler of epicsTimer Jun-ichi Odagiri
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: pv connect/disconnect callbacks john sinclair
Next: About: timeout handler of epicsTimer Jun-ichi Odagiri
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024