On 25.09.2013 20:24, Benjamin Franksen wrote:
Am Mittwoch, 25. September 2013, 06:50:18 schrieb Eric Norum:
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.
I am using that approach, too, at least when I (have to) use semaphores
directly. Whenever possible I use message queues nowadays, and I type
the messages using a tagged union, just as I would with an algebraic
datatype in Haskell. [...] shutdown is now just another message type:
enum msgTag {
...,
MSG_SHUTDOWN /* normally needs no extra data */
};
I find it much easier to reason about my code if it is structured in
this way.
Thank you Eric and Ben for your suggestions.
Dirk
- References:
- cleaning up at exit and waiting threads Dirk Zimoch
- Re: cleaning up at exit and waiting threads Eric Norum
- Re: cleaning up at exit and waiting threads Benjamin Franksen
- Navigate by Date:
- Prev:
Re: String Read Ralph Lange
- Next:
agenda for the EPICS users' meeting Dalesio, Leo
- 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:
Re: cleaning up at exit and waiting threads Benjamin Franksen
- 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
|