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
- 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
<2015>
2016
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
<2015>
2016
2017
2018
2019
2020
2021
2022
2023
2024
|