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

Subject: Re: cleaning up at exit and waiting threads
From: Eric Norum <[email protected]>
To: Dirk Zimoch <[email protected]>
Cc: EPICS <[email protected]>
Date: Wed, 25 Sep 2013 06:50:18 -0700
I think that it's not a bug.   It's more a 'least common denominator' issue with the assorted platforms on which EPICS runs.  
My approach has been to add a 'pleaseTerminate' event to the device private structure then place a check for this event right after the 'wait for work' event in the worker thread.  Shutdown requests first set the pleaseTerminate event and then the normal check-for-work event.

On Sep 25, 2013, at 6:15 AM, Dirk Zimoch <[email protected]> wrote:

> Hi folks,
> 
> Today I did some tests regarding "clean" shutdown of an IOC and found some unsatisfying results. There seems to be no clean way of destroying events, mutexes, or message queues, because they all cannot be destroyed as long as there are threads waiting on them. At least that is the case on Linux.
> 
> Example: One thread is waiting on an event. Whenever it gets signaled, it does some work on hardware.
> 
> At exit I have do shutdown the hardware cleanly. After this time no thread must try to use it any more. Also I better don't simply kill the work thread while it is accessing the hardware. (And I probably do not know all the threads involved). So I prefer to terminate while the thread has noting to do, i.e. while it is waiting on the event.
> 
> I had expected that when I destroy the queue, all pending threads would wake up and receive an error. This is not the case. Instead I found that destroying the event failed with "Device or resource busy"
> 
> The same is true for mutexes as I tested. Also message queues cannot be released like this.
> 
> Is this a bug or simply "unsupported"?
> 
> Any idea what I can do?
> 
> Dirk
> 

-- 
Eric Norum
[email protected]






Replies:
Re: cleaning up at exit and waiting threads Benjamin Franksen
References:
cleaning up at exit and waiting threads Dirk Zimoch

Navigate by Date:
Prev: cleaning up at exit and waiting threads Dirk Zimoch
Next: sequencer release 2.1.14 Benjamin Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: cleaning up at exit and waiting threads Dirk Zimoch
Next: Re: cleaning up at exit and waiting threads Benjamin Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·