Skip to content

Commit eae4bab

Browse files
committed
Notify scope on coroutine enqueue: add callback to handle new coroutine addition
1 parent 03642bf commit eae4bab

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

scheduler.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,14 @@ bool async_scheduler_coroutine_enqueue(zend_coroutine_t *coroutine)
10321032
}
10331033

10341034
ZEND_ASYNC_INCREASE_COROUTINE_COUNT;
1035+
1036+
// Notify scope that a new coroutine has been enqueued
1037+
zend_async_scope_t *scope = coroutine->scope;
1038+
scope->after_coroutine_enqueue(coroutine, scope);
1039+
if (UNEXPECTED(EG(exception))) {
1040+
coroutine->waker->status = ZEND_ASYNC_WAKER_IGNORED;
1041+
return false;
1042+
}
10351043
}
10361044

10371045
// Add to resumed_coroutines queue for event cleanup

0 commit comments

Comments
 (0)