Conveyor: Change run() to follow MAD's skeleton
This is still broken if a client method (notify() or the destructor) deletes the conveyor, which accesses data members before exiting.
This commit is contained in:

committed by
mdavidsaver

parent
a9725834dc
commit
e00ccbeb9c
@ -56,13 +56,15 @@ void NotifierConveyor::notifyClient(
|
||||
|
||||
void NotifierConveyor::run()
|
||||
{
|
||||
bool stopping;
|
||||
do {
|
||||
workToDo.wait();
|
||||
epicsGuard<epicsMutex> G(mutex);
|
||||
stopping = halt;
|
||||
while (!stopping && !workQueue.empty())
|
||||
epicsGuard<epicsMutex> G(mutex);
|
||||
bool stopping = halt;
|
||||
while (!stopping) {
|
||||
{
|
||||
epicsGuardRelease<epicsMutex> U(G);
|
||||
workToDo.wait();
|
||||
}
|
||||
stopping = halt;
|
||||
while (!stopping && !workQueue.empty()) {
|
||||
NotificationWPtr notificationWPtr(workQueue.front());
|
||||
workQueue.pop();
|
||||
NotificationPtr notification(notificationWPtr.lock());
|
||||
@ -85,7 +87,7 @@ void NotifierConveyor::run()
|
||||
// client's destructor may run here, could delete *this
|
||||
}
|
||||
}
|
||||
} while (!stopping);
|
||||
}
|
||||
}
|
||||
|
||||
}}}
|
||||
|
Reference in New Issue
Block a user