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