Mark Sizer wrote:
static bool ReceiverBody::bShuttingDown() { bool bLocalStop = false; { boost::mutex::scoped_lock lockStop( _mutexStop ); bLocalStop = _bStop; }
return bLocalStop; } Note that this can't be const, even though it sort-of is. It modifies the mutex, even though that doesn't matter to the logical state of the object.
Mark, a tip on that. I don't know if this applies to boost mutex or not, but if their system is like mine, then you can declare _mutexStop with the mutable keyword. Then you can declare the method bShuttingDown as const. At first it might seem like a bad thing, saying const when you really don't mean it, but I believe that for member functions const means that the state of the object does not change as a result of the function -- and it won't, because the state before and after is the same. Jason