Hi John,
On 08/21/2018 03:37 PM, Sinclair, John William wrote:
> When I say that edm is single threaded, I mean there should never be
> contention for resources among multiple threads.
>
> Edm calls ca_context_create( ca_disable_preemptive_callback );
>
> I believe that forces callbacks to always occur in the thread in which
> the callback was requested.
That isn't quite the case, but it's close and should be sufficient as
long as no other code is thread-aware or using thread-local variables.
What it actually does is ensure that the main thread is inside a call to
ca_pend_event() or ca_pend_io() before calling the callbacks, but those
callbacks do occur (one at a time, never simultaneously) from other CA
threads though (using a different thread for each IOC or CA server the
library is connected to). The main thread will never return to the
application code until all callbacks in the other threads have returned.
This prevents race conditions between the main thread and the callbacks
because CA handles all of the synchronization that is needed for a
"thread-naive" application.
The situation may be slightly different if the application's callback
routines make calls into a library that is itself thread-aware and/or
uses thread-local variables internally — any thread-local variables
might not have been properly initialized for the CA's per-IOC threads.
The symptoms described don't seem to imply that's the problem here, but
I can't guarantee it.
- Andrew
--
Arguing for surveillance because you have nothing to hide is no
different than making the claim, "I don't care about freedom of
speech because I have nothing to say." -- Edward Snowdon
- References:
- EDM X/Y Plot segfaults Eric Norum
- Re: EDM X/Y Plot segfaults Eric Norum
- Re: EDM X/Y Plot segfaults Bruce Hill
- RE: EDM X/Y Plot segfaults Baily, Scott A
- Re: EDM X/Y Plot segfaults Bruce Hill
- Re: EDM X/Y Plot segfaults Bruce Hill
- Re: EDM X/Y Plot segfaults Christoph Schroeder
- RE: EDM X/Y Plot segfaults Sinclair, John William
- Re: EDM X/Y Plot segfaults Bruce Hill
- RE: EDM X/Y Plot segfaults Sinclair, John William
- Re: EDM X/Y Plot segfaults Bruce Hill
- RE: EDM X/Y Plot segfaults Sinclair, John William
- Navigate by Date:
- Prev:
RE: EDM X/Y Plot segfaults Sinclair, John William
- Next:
EPICs suddenly not connecting to devices John Teah
- 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: EDM X/Y Plot segfaults Sinclair, John William
- Next:
RE: EDM X/Y Plot segfaults Baily, Scott A
- 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
|