File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -589,7 +589,7 @@ static aeTimeEvent *aeSearchNearestTimer(aeEventLoop *eventLoop)
589
589
590
590
/* Process time events */
591
591
static int processTimeEvents (aeEventLoop *eventLoop) {
592
- std::unique_lock<decltype (g_lock)> ulock (g_lock);
592
+ std::unique_lock<decltype (g_lock)> ulock (g_lock, std::defer_lock );
593
593
int processed = 0 ;
594
594
aeTimeEvent *te;
595
595
long long maxId;
@@ -634,8 +634,10 @@ static int processTimeEvents(aeEventLoop *eventLoop) {
634
634
eventLoop->timeEventHead = te->next ;
635
635
if (te->next )
636
636
te->next ->prev = te->prev ;
637
- if (te->finalizerProc )
637
+ if (te->finalizerProc ) {
638
+ if (!ulock.owns_lock ()) ulock.lock ();
638
639
te->finalizerProc (eventLoop, te->clientData );
640
+ }
639
641
zfree (te);
640
642
te = next;
641
643
continue ;
@@ -654,6 +656,7 @@ static int processTimeEvents(aeEventLoop *eventLoop) {
654
656
if (now_sec > te->when_sec ||
655
657
(now_sec == te->when_sec && now_ms >= te->when_ms ))
656
658
{
659
+ if (!ulock.owns_lock ()) ulock.lock ();
657
660
int retval;
658
661
659
662
id = te->id ;
You can’t perform that action at this time.
0 commit comments