@@ -1077,10 +1077,39 @@ struct _zend_future_s {
1077
1077
zend_async_event_t event ; /* Event inheritance (first member) */
1078
1078
zval result ; /* Result value */
1079
1079
zend_object * exception ; /* Exception object (NULL = no error) */
1080
+ /* Created file and line number */
1081
+ uint32_t lineno ;
1082
+ uint32_t completed_lineno ;
1083
+ /* Completed file and line number */
1084
+ zend_string * filename ;
1085
+ zend_string * completed_filename ;
1080
1086
};
1081
1087
1082
1088
#define ZEND_FUTURE_F_THREAD_SAFE (1u << 10)
1083
- #define ZEND_FUTURE_F_IGNORE (1u << 11)
1089
+ #define ZEND_FUTURE_F_IGNORED (1u << 11)
1090
+
1091
+ #define ZEND_FUTURE_IS_COMPLETED (future ) (((future)->event.flags & ZEND_ASYNC_EVENT_F_CLOSED) != 0)
1092
+
1093
+ #define ZEND_FUTURE_SET_THREAD_SAFE (future ) ((future)->event.flags |= ZEND_FUTURE_F_THREAD_SAFE)
1094
+ #define ZEND_FUTURE_SET_IGNORED (future ) ((future)->event.flags |= ZEND_FUTURE_F_IGNORED)
1095
+
1096
+
1097
+ #define ZEND_FUTURE_COMPLETE (future , result ) do { \
1098
+ if(ZEND_ASYNC_EVENT_IS_CLOSED(&(future)->event)) { \
1099
+ break; \
1100
+ } \
1101
+ ZVAL_COPY(&(future)->result, (result)); \
1102
+ (future)->event.stop(&(future)->event); \
1103
+ } while (0)
1104
+
1105
+ #define ZEND_FUTURE_REJECT (future , error ) do { \
1106
+ if(ZEND_ASYNC_EVENT_IS_CLOSED(&(future)->event)) { \
1107
+ break; \
1108
+ } \
1109
+ (future)->exception = error; \
1110
+ GC_ADDREF(error); \
1111
+ (future)->event.stop(&(future)->event); \
1112
+ } while (0)
1084
1113
1085
1114
///////////////////////////////////////////////////////////////
1086
1115
/// Channel
@@ -1092,7 +1121,6 @@ struct _zend_future_s {
1092
1121
*/
1093
1122
struct _zend_async_channel_s {
1094
1123
zend_async_event_t event ; /* Event inheritance (first member) */
1095
-
1096
1124
/* Channel-specific method pointers */
1097
1125
zend_channel_send_t send ; /* Send method */
1098
1126
zend_channel_receive_t receive ; /* Receive method */
0 commit comments