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  2014  <20152016  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  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: areaDetector plugins: what variables can be accessed while unlocked?
From: Mark Rivers <[email protected]>
To: Phil Atkin <[email protected]>, "[email protected]" <[email protected]>
Date: Tue, 15 Dec 2015 14:05:35 +0000
Hi Phil,

> I think it should be OK to access member variables of the plugin class (i.e. the class derived from NDPluginDriver), in addition to local (stack) variables.

When your prcoessCallbacks, writeInt32, etc. methods are called the lock will already be taken, so it is OK to access anything.  If you release the lock because you are doing a time-consuming operation, then you need to be careful.  You must not access the parameter library (setIntegerParam, getIntegerParam, callParamCallbacks, etc.).  If you access private or protected member data you need to be sure that data cannot be accessed by another thread, such as the one that will call writeInt32, writeFloat64, etc.  You can be sure that another thread will not call processCallbacks while another call to it is still executing.

> And I presume that by "class variables" what's meant is members that are generally referred to in C++ as static member variables.

No, that is not what I meant, I meant normal member variables.  For example, if your writeInt32 method accesses one of those variables then you must not access it in processCallbacks without the lock, because those will be running in different threads.

Mark

________________________________
From: [email protected] [[email protected]] on behalf of Phil Atkin [[email protected]]
Sent: Tuesday, December 15, 2015 4:51 AM
To: [email protected]
Subject: areaDetector plugins: what variables can be accessed while unlocked?

Hi,

In the "Guidelines and rules for plugins" is this statement: "Obviously [plugins] must not access memory locations that other threads could modify [while the mutex lock is not taken], so they should only access local variables, not class variables (which includes the parameter library)".

I think it should be OK to access member variables of the plugin class (i.e. the class derived from NDPluginDriver), in addition to local (stack) variables.  And I presume that by "class variables" what's meant is members that are generally referred to in C++ as static member variables.  Am I correct?

Cheers,

Phil

--
[cid:[email protected]]Pixel Analytics is a limited company registered in England. Company number: 7747526; Registered office: 93A New Road, Haslingfield, Cambridge CB23 1LP

PNG image


References:
areaDetector plugins: what variables can be accessed while unlocked? Phil Atkin

Navigate by Date:
Prev: areaDetector plugins: what variables can be accessed while unlocked? Phil Atkin
Next: epics docker container Carlos Pascual
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: areaDetector plugins: what variables can be accessed while unlocked? Phil Atkin
Next: epics docker container Carlos Pascual
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 16 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·