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 | 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 |
<== Date ==> | <== Thread ==> |
---|
Subject: | cleaning up at exit and waiting threads |
From: | Dirk Zimoch <[email protected]> |
To: | EPICS <[email protected]> |
Date: | Wed, 25 Sep 2013 15:15:06 +0200 |
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