Merge branch 'keydbpro' into keydbpro_collab
Former-commit-id: 40187ebd4cc479fa86a3ee5cca9bedef7d488ee7
This commit is contained in:
commit
7af5eb2ee3
@ -18,13 +18,14 @@ void AsyncWorkQueue::WorkerThreadMain()
|
|||||||
|
|
||||||
vars.clients_pending_asyncwrite = listCreate();
|
vars.clients_pending_asyncwrite = listCreate();
|
||||||
|
|
||||||
aeAcquireLock();
|
m_mutex.lock();
|
||||||
m_vecpthreadVars.push_back(&vars);
|
m_vecpthreadVars.push_back(&vars);
|
||||||
aeReleaseLock();
|
m_mutex.unlock();
|
||||||
|
|
||||||
while (!m_fQuitting)
|
while (!m_fQuitting)
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lock(m_mutex);
|
std::unique_lock<std::mutex> lock(m_mutex);
|
||||||
|
if (m_workqueue.empty())
|
||||||
m_cvWakeup.wait(lock);
|
m_cvWakeup.wait(lock);
|
||||||
|
|
||||||
while (!m_workqueue.empty())
|
while (!m_workqueue.empty())
|
||||||
@ -41,9 +42,11 @@ void AsyncWorkQueue::WorkerThreadMain()
|
|||||||
|
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
serverTL->gcEpoch = g_pserver->garbageCollector.startEpoch();
|
serverTL->gcEpoch = g_pserver->garbageCollector.startEpoch();
|
||||||
|
if (listLength(serverTL->clients_pending_asyncwrite)) {
|
||||||
aeAcquireLock();
|
aeAcquireLock();
|
||||||
ProcessPendingAsyncWrites();
|
ProcessPendingAsyncWrites();
|
||||||
aeReleaseLock();
|
aeReleaseLock();
|
||||||
|
}
|
||||||
g_pserver->garbageCollector.endEpoch(serverTL->gcEpoch);
|
g_pserver->garbageCollector.endEpoch(serverTL->gcEpoch);
|
||||||
serverTL->gcEpoch.reset();
|
serverTL->gcEpoch.reset();
|
||||||
}
|
}
|
||||||
@ -60,6 +63,7 @@ bool AsyncWorkQueue::removeClientAsyncWrites(client *c)
|
|||||||
{
|
{
|
||||||
bool fFound = false;
|
bool fFound = false;
|
||||||
aeAcquireLock();
|
aeAcquireLock();
|
||||||
|
m_mutex.lock();
|
||||||
for (auto pvars : m_vecpthreadVars)
|
for (auto pvars : m_vecpthreadVars)
|
||||||
{
|
{
|
||||||
listIter li;
|
listIter li;
|
||||||
@ -74,6 +78,7 @@ bool AsyncWorkQueue::removeClientAsyncWrites(client *c)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m_mutex.unlock();
|
||||||
aeReleaseLock();
|
aeReleaseLock();
|
||||||
return fFound;
|
return fFound;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user