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.