Move caProvider worker threads shutdown to static destructors
This commit is contained in:
committed by
mdavidsaver
parent
44fda51935
commit
601280836d
@@ -39,6 +39,12 @@ PutDoneThread::PutDoneThread()
|
||||
|
||||
PutDoneThread::~PutDoneThread()
|
||||
{
|
||||
{
|
||||
Lock xx(mutex);
|
||||
isStop = true;
|
||||
}
|
||||
waitForCommand.signal();
|
||||
waitForStop.wait();
|
||||
}
|
||||
|
||||
|
||||
@@ -55,12 +61,6 @@ void PutDoneThread::start()
|
||||
|
||||
void PutDoneThread::stop()
|
||||
{
|
||||
{
|
||||
Lock xx(mutex);
|
||||
isStop = true;
|
||||
}
|
||||
waitForCommand.signal();
|
||||
waitForStop.wait();
|
||||
}
|
||||
|
||||
void PutDoneThread::putDone(NotifyPutRequesterPtr const ¬ifyPutRequester)
|
||||
@@ -76,37 +76,34 @@ void PutDoneThread::putDone(NotifyPutRequesterPtr const ¬ifyPutRequester)
|
||||
|
||||
void PutDoneThread::run()
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
waitForCommand.wait();
|
||||
while(true) {
|
||||
bool more = false;
|
||||
NotifyPutRequester* notifyPutRequester(NULL);
|
||||
{
|
||||
Lock lock(mutex);
|
||||
if(!notifyPutQueue.empty())
|
||||
{
|
||||
more = true;
|
||||
NotifyPutRequesterWPtr req(notifyPutQueue.front());
|
||||
notifyPutQueue.pop();
|
||||
NotifyPutRequesterPtr reqPtr(req.lock());
|
||||
if(reqPtr) {
|
||||
notifyPutRequester = reqPtr.get();
|
||||
reqPtr->isOnQueue = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!more) break;
|
||||
if(notifyPutRequester!=NULL)
|
||||
{
|
||||
CAChannelPutPtr channelPut(notifyPutRequester->channelPut.lock());
|
||||
if(channelPut) channelPut->notifyClient();
|
||||
}
|
||||
}
|
||||
if(stopping()) {
|
||||
waitForStop.signal();
|
||||
break;
|
||||
}
|
||||
while (true) {
|
||||
waitForCommand.wait();
|
||||
while (true) {
|
||||
bool more = false;
|
||||
NotifyPutRequester* notifyPutRequester(NULL);
|
||||
{
|
||||
Lock lock(mutex);
|
||||
if (!notifyPutQueue.empty()) {
|
||||
more = true;
|
||||
NotifyPutRequesterWPtr req(notifyPutQueue.front());
|
||||
notifyPutQueue.pop();
|
||||
NotifyPutRequesterPtr reqPtr(req.lock());
|
||||
if (reqPtr) {
|
||||
notifyPutRequester = reqPtr.get();
|
||||
reqPtr->isOnQueue = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!more) break;
|
||||
if (notifyPutRequester!=NULL) {
|
||||
CAChannelPutPtr channelPut(notifyPutRequester->channelPut.lock());
|
||||
if (channelPut) channelPut->notifyClient();
|
||||
}
|
||||
}
|
||||
if (stopping()) {
|
||||
waitForStop.signal();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user