processEventsWhileBlocked not exception safe
Former-commit-id: 45b711f9d124a948a66e667992176b5387943512
This commit is contained in:
parent
79e945f5e5
commit
d90ebb9f85
@ -3183,6 +3183,7 @@ void unpauseClientsIfNecessary()
|
|||||||
*
|
*
|
||||||
* The function returns the total number of events processed. */
|
* The function returns the total number of events processed. */
|
||||||
int processEventsWhileBlocked(int iel) {
|
int processEventsWhileBlocked(int iel) {
|
||||||
|
serverAssert(GlobalLocksAcquired());
|
||||||
int iterations = 4; /* See the function top-comment. */
|
int iterations = 4; /* See the function top-comment. */
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
@ -3194,6 +3195,8 @@ int processEventsWhileBlocked(int iel) {
|
|||||||
}
|
}
|
||||||
aeReleaseLock();
|
aeReleaseLock();
|
||||||
serverAssertDebug(!GlobalLocksAcquired());
|
serverAssertDebug(!GlobalLocksAcquired());
|
||||||
|
try
|
||||||
|
{
|
||||||
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);
|
||||||
@ -3201,6 +3204,17 @@ int processEventsWhileBlocked(int iel) {
|
|||||||
if (!events) break;
|
if (!events) break;
|
||||||
count += events;
|
count += events;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
// Caller expects us to be locked so fix and rethrow
|
||||||
|
AeLocker locker;
|
||||||
|
if (c != nullptr)
|
||||||
|
c->lock.lock();
|
||||||
|
locker.arm(c);
|
||||||
|
locker.release();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
AeLocker locker;
|
AeLocker locker;
|
||||||
if (c != nullptr)
|
if (c != nullptr)
|
||||||
c->lock.lock();
|
c->lock.lock();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user