Eliminate unnecessary global locks
Former-commit-id: 8f924ed0979f3cf7cd290395d1b1eec358979325
This commit is contained in:
parent
a2010f17b8
commit
ac49c7158c
@ -18,9 +18,9 @@ void AsyncWorkQueue::WorkerThreadMain()
|
||||
|
||||
vars.clients_pending_asyncwrite = listCreate();
|
||||
|
||||
aeAcquireLock();
|
||||
m_mutex.lock();
|
||||
m_vecpthreadVars.push_back(&vars);
|
||||
aeReleaseLock();
|
||||
m_mutex.unlock();
|
||||
|
||||
while (!m_fQuitting)
|
||||
{
|
||||
@ -42,9 +42,11 @@ void AsyncWorkQueue::WorkerThreadMain()
|
||||
|
||||
lock.unlock();
|
||||
serverTL->gcEpoch = g_pserver->garbageCollector.startEpoch();
|
||||
if (listLength(serverTL->clients_pending_asyncwrite)) {
|
||||
aeAcquireLock();
|
||||
ProcessPendingAsyncWrites();
|
||||
aeReleaseLock();
|
||||
}
|
||||
g_pserver->garbageCollector.endEpoch(serverTL->gcEpoch);
|
||||
serverTL->gcEpoch.reset();
|
||||
}
|
||||
@ -61,6 +63,7 @@ bool AsyncWorkQueue::removeClientAsyncWrites(client *c)
|
||||
{
|
||||
bool fFound = false;
|
||||
aeAcquireLock();
|
||||
m_mutex.lock();
|
||||
for (auto pvars : m_vecpthreadVars)
|
||||
{
|
||||
listIter li;
|
||||
@ -75,6 +78,7 @@ bool AsyncWorkQueue::removeClientAsyncWrites(client *c)
|
||||
}
|
||||
}
|
||||
}
|
||||
m_mutex.unlock();
|
||||
aeReleaseLock();
|
||||
return fFound;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user