processEventsWhileBlocked needs to release the lock in a safe way
Former-commit-id: 1a70af2ae13962db038b0635cc29488019323538
This commit is contained in:
parent
60c35d6ea7
commit
8b44d86c7c
@ -2998,6 +2998,14 @@ int processEventsWhileBlocked(int iel) {
|
|||||||
int iterations = 4; /* See the function top-comment. */
|
int iterations = 4; /* See the function top-comment. */
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
client *c = serverTL->current_client;
|
||||||
|
if (c != nullptr)
|
||||||
|
{
|
||||||
|
serverAssert(c->flags & CLIENT_PROTECTED);
|
||||||
|
c->lock.unlock();
|
||||||
|
c->db->lock.unlock();
|
||||||
|
}
|
||||||
|
aeReleaseLock();
|
||||||
while (iterations--) {
|
while (iterations--) {
|
||||||
int events = 0;
|
int events = 0;
|
||||||
events += aeProcessEvents(g_pserver->rgthreadvar[iel].el, AE_FILE_EVENTS|AE_DONT_WAIT);
|
events += aeProcessEvents(g_pserver->rgthreadvar[iel].el, AE_FILE_EVENTS|AE_DONT_WAIT);
|
||||||
@ -3005,6 +3013,13 @@ int processEventsWhileBlocked(int iel) {
|
|||||||
if (!events) break;
|
if (!events) break;
|
||||||
count += events;
|
count += events;
|
||||||
}
|
}
|
||||||
|
AeLocker locker;
|
||||||
|
if (c != nullptr)
|
||||||
|
c->lock.lock();
|
||||||
|
locker.arm(c);
|
||||||
|
if (c != nullptr)
|
||||||
|
c->db->lock.lock();
|
||||||
|
locker.release();
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user