Skip to content

Commit f915035

Browse files
committed
+ Enhance coroutine creation and scheduler scope handling
% removal of the current Scope from the global structure
1 parent d7132fd commit f915035

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

Zend/zend_async_API.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ static void ts_globals_ctor(zend_async_globals_t * globals)
117117
globals->active_coroutine_count = 0;
118118
globals->active_event_count = 0;
119119
globals->coroutine = NULL;
120-
globals->scope = NULL;
121120
globals->scheduler = NULL;
122121
globals->exit_exception = NULL;
123122
}

Zend/zend_async_API.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ END_EXTERN_C()
813813
#define ZEND_ASYNC_GRACEFUL_SHUTDOWN ZEND_ASYNC_G(graceful_shutdown)
814814
#define ZEND_ASYNC_EXIT_EXCEPTION ZEND_ASYNC_G(exit_exception)
815815
#define ZEND_ASYNC_CURRENT_COROUTINE ZEND_ASYNC_G(coroutine)
816-
#define ZEND_ASYNC_CURRENT_SCOPE ZEND_ASYNC_G(scope)
816+
#define ZEND_ASYNC_CURRENT_SCOPE ZEND_ASYNC_G(coroutine)->scope
817817
#define ZEND_ASYNC_SCHEDULER ZEND_ASYNC_G(scheduler)
818818

819819
#define ZEND_ASYNC_INCREASE_EVENT_COUNT if (ZEND_ASYNC_G(active_event_count) < UINT_MAX) { \
@@ -1032,6 +1032,6 @@ END_EXTERN_C()
10321032

10331033
/* Context API Macros */
10341034
#define ZEND_ASYNC_NEW_CONTEXT(parent) zend_async_new_context_fn(parent)
1035-
#define ZEND_ASYNC_CURRENT_CONTEXT ZEND_ASYNC_G(scope)->context
1035+
#define ZEND_ASYNC_CURRENT_CONTEXT (ZEND_ASYNC_G(coroutine) != NULL ? ZEND_ASYNC_G(coroutine)->scope->context : NULL)
10361036

10371037
#endif //ZEND_ASYNC_API_H

0 commit comments

Comments
 (0)