Skip to content

Commit 70d68f3

Browse files
committed
% refactoring typedef zend_async_iterator_t* (*zend_async_new_iterator_t)(
zval *array, zend_object_iterator *zend_iterator, zend_fcall_t *fcall, zend_async_iterator_handler_t handler, zend_async_scope_t *scope, unsigned int concurrency, int32_t priority, size_t iterator_size ); add scope parameter
1 parent 7a8aac8 commit 70d68f3

File tree

5 files changed

+10
-1
lines changed

5 files changed

+10
-1
lines changed

async_API.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@ void iterator_coroutine_first_entry(void)
522522
await_iterator->zend_iterator,
523523
NULL,
524524
await_iterator_handler,
525+
ZEND_ASYNC_CURRENT_SCOPE,
525526
await_context->concurrency,
526527
0,
527528
sizeof(async_await_iterator_iterator_t)

coroutine.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ static void async_coroutine_call_finally_handlers(async_coroutine_t *coroutine)
416416
NULL,
417417
NULL,
418418
finally_handlers_iterator_handler,
419+
coroutine->coroutine.scope,
419420
0,
420421
0,
421422
0

iterator.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ async_iterator_t * async_iterator_new(
106106
zend_object_iterator *zend_iterator,
107107
zend_fcall_t *fcall,
108108
async_iterator_handler_t handler,
109+
zend_async_scope_t *scope,
109110
unsigned int concurrency,
110111
int32_t priority,
111112
size_t iterator_size
@@ -129,6 +130,11 @@ async_iterator_t * async_iterator_new(
129130
iterator->concurrency = concurrency;
130131
iterator->priority = priority;
131132

133+
if (scope == NULL) {
134+
scope = ZEND_ASYNC_CURRENT_SCOPE;
135+
}
136+
iterator->scope = scope;
137+
132138
if (zend_iterator == NULL) {
133139
ZVAL_COPY(&iterator->array, array);
134140
} else if (zend_iterator) {

iterator.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ async_iterator_t * async_iterator_new(
3636
zend_object_iterator *zend_iterator,
3737
zend_fcall_t *fcall,
3838
async_iterator_handler_t handler,
39+
zend_async_scope_t *scope,
3940
unsigned int concurrency,
4041
int32_t priority,
4142
size_t iterator_size

scope.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1482,6 +1482,7 @@ static void async_scope_call_finally_handlers(async_scope_t *scope)
14821482
NULL,
14831483
NULL,
14841484
scope_finally_handlers_iterator_handler,
1485+
child_scope,
14851486
0,
14861487
1,
14871488
0
@@ -1498,7 +1499,6 @@ static void async_scope_call_finally_handlers(async_scope_t *scope)
14981499
context->scope = scope;
14991500
context->composite_exception = NULL;
15001501

1501-
iterator->scope = child_scope;
15021502
iterator->extended_data = context;
15031503
iterator->extended_dtor = scope_finally_handlers_iterator_dtor;
15041504

0 commit comments

Comments
 (0)