@@ -713,7 +713,7 @@ struct _zend_async_scope_s {
713
713
/**
714
714
* The method handles an exception delivered to the Scope.
715
715
* Its result may either be the cancellation of the Scope or the suppression of the exception.
716
- * If the coroutine parameter is specified , it indicates an attempt to handle an exception from a coroutine.
716
+ * If the is_cancellation parameter is FALSE , it indicates an attempt to handle an exception from a coroutine.
717
717
* Otherwise, it's an attempt by the user to stop the execution of the Scope.
718
718
*
719
719
* The method should return true if the exception was handled and the Scope can continue execution.
@@ -723,12 +723,23 @@ struct _zend_async_scope_s {
723
723
bool (* catch_or_cancel )(
724
724
zend_async_scope_t * scope ,
725
725
zend_coroutine_t * coroutine ,
726
+ zend_async_scope_t * from_scope ,
726
727
zend_object * exception ,
727
728
bool transfer_error ,
728
- const bool is_safely
729
+ const bool is_safely ,
730
+ const bool is_cancellation
729
731
);
730
732
};
731
733
734
+ #define ZEND_ASYNC_SCOPE_CLOSE (scope , is_safely ) \
735
+ ((scope)->catch_or_cancel((scope), NULL, NULL, NULL, false, (is_safely), true))
736
+
737
+ #define ZEND_ASYNC_SCOPE_CANCEL (scope , exception , transfer_error , is_safely ) \
738
+ ((scope)->catch_or_cancel((scope), NULL, NULL, (exception), (transfer_error), (is_safely), true))
739
+
740
+ #define ZEND_ASYNC_SCOPE_CATCH (scope , coroutine , from_scope , exception , transfer_error , is_safely ) \
741
+ ((scope)->catch_or_cancel((scope), (coroutine), (from_scope), (exception), (transfer_error), (is_safely), false))
742
+
732
743
#define ZEND_ASYNC_SCOPE_F_CLOSED ZEND_ASYNC_EVENT_F_CLOSED /* scope was closed */
733
744
#define ZEND_ASYNC_SCOPE_F_NO_FREE_MEMORY ZEND_ASYNC_EVENT_F_NO_FREE_MEMORY /* scope will not free memory in dispose handler */
734
745
#define ZEND_ASYNC_SCOPE_F_DISPOSE_SAFELY (1u << 14) /* scope will be disposed safely */
0 commit comments