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  2015  <20162017  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  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: processCallbacks() never called in areaDetector plugin
From: Mark Rivers <[email protected]>
To: 'Siniša Veseli' <[email protected]>, "[email protected]" <[email protected]>
Date: Tue, 8 Nov 2016 17:14:08 +0000
> What was causing the problem with this being handled in the base class  as before?

The start() method was added in R2-5.  The problem was race conditions that were discovered when running the unit tests in the pluginTest directory.  Those tests instantiate drivers and plugins that only exist for a very short amount of time.  As I recall the problems were one or more of the following:

- The first callback occurred before the thread that processes the plugins had started running.  The callbacks can start as soon as the base class constructor is called.

- The first callback occurred before the derived class constructor was complete.  In this case the base class processCallbacks method will be called, not the derived class method, which is not what is intended.

- The destructor was called before the thread had a chance to process the callback.

To fix these problems the start() method was added, and it must be called by the code that instantiates the plugin.

Mark


-----Original Message-----
From: Siniša Veseli [mailto:[email protected]] 
Sent: Tuesday, November 08, 2016 7:33 AM
To: Mark Rivers; [email protected]
Subject: Re: processCallbacks() never called in areaDetector plugin

Uhh, thanks, I keep forgetting that it should be in the configure code. 
What was causing the problem with this being handled in the base class 
as before?


Sinisa

On 11/8/16 7:08 AM, Mark Rivers wrote:
> Actually I think you need to call start() in the code that created the object, not in the constructor.  The problem is that the derived class needs to be completely constructed before start() is called.
>
> This is the example from NDPluginStdArrays:
>
> /* Configuration routine.  Called directly, or from the iocsh function */
> extern "C" int NDStdArraysConfigure(const char *portName, int queueSize, int blockingCallbacks,
>                                      const char *NDArrayPort, int NDArrayAddr, size_t maxMemory,
>                                      int priority, int stackSize)
> {
>      NDPluginStdArrays *pPlugin = new NDPluginStdArrays(portName, queueSize, blockingCallbacks, NDArrayPort, NDArrayAddr, maxMemory,
>                                                         priority, stackSize);
>      return pPlugin->start();
> }
>
>
> ________________________________________
> From: [email protected] [[email protected]] on behalf of Siniša Veseli [[email protected]]
> Sent: Tuesday, November 08, 2016 7:03 AM
> To: [email protected]
> Subject: Re: processCallbacks() never called in areaDetector plugin
>
> Hi,
>
> If you are using ADCore 2-5, you probably need to call start() in your
> plugin's constructor.
>
> Sinisa
>
>
> On 11/8/16 6:28 AM, Jonas Nilsson wrote:
>> Hi,
>> I am trying to learn how to write an areaDetector plugin. As a
>> starting point I have tried to use the "NDStdArrays" plugin and simply
>> switched all the names in the relevant source files to something else
>> so as to not cause a conflict with the existing NDStdArrays plugin.
>> The problem is that whereas the original NDStdArrays plugin appears to
>> work correctly (ArrayCounter_RBV increases), my version does not
>> appear to do so.
>>
>> I have put some simple debug messages into all the functions and
>> member functions in the source file and while the plugin appears to
>> initialize correctly, processCallbacks(NDArray *pArray) is never called.
>>
>> The plugin is enabled (EnableCallbacks_RBV returns "Enable") and I can
>> see no error or warning messages when starting iocsh. Does anyone have
>> a good idea on what might be a common beginners problem or how to
>> debug the problem?
>>
>> Regards,
>> Jonas
> --
> Siniša Veseli
> Scientific Software Engineering & Data Management
> Advanced Photon Source
> Argonne National Laboratory
> [email protected]
> (630)252-9182
>

-- 
Siniša Veseli
Scientific Software Engineering & Data Management
Advanced Photon Source
Argonne National Laboratory
[email protected]
(630)252-9182



Replies:
Re: processCallbacks() never called in areaDetector plugin Ben Franksen
References:
processCallbacks() never called in areaDetector plugin Jonas Nilsson
Re: processCallbacks() never called in areaDetector plugin Siniša Veseli
RE: processCallbacks() never called in areaDetector plugin Mark Rivers
Re: processCallbacks() never called in areaDetector plugin Siniša Veseli

Navigate by Date:
Prev: RE: Packed Data Message Formats With Fixed-Length Strings Mooney, Tim M.
Next: Re: Multiple NDPluginPva issues Pearson, Matthew R.
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: processCallbacks() never called in areaDetector plugin Alexander Söderqvist
Next: Re: processCallbacks() never called in areaDetector plugin Ben Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 08 Nov 2016 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·