Skip to content

Commit 94227f5

Browse files
committed
php#13: Initial classes for Future
1 parent e1e7d6c commit 94227f5

File tree

1 file changed

+36
-38
lines changed

1 file changed

+36
-38
lines changed

Zend/zend_async_API.h

Lines changed: 36 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,6 @@ typedef struct _zend_async_iterator_s zend_async_iterator_t;
137137
typedef struct _zend_fcall_s zend_fcall_t;
138138
typedef void (*zend_coroutine_entry_t)(void);
139139

140-
/* Future resolve function type */
141-
typedef void (*zend_future_resolve_t)(zend_future_t *future, zval *value, zend_object *exception, bool transfer_error);
142-
143140
/* Channel method function types */
144141
typedef bool (*zend_channel_send_t)(zend_async_channel_t *channel, zval *value);
145142
typedef bool (*zend_channel_receive_t)(zend_async_channel_t *channel, zval *result);
@@ -982,41 +979,6 @@ struct _zend_coroutine_s {
982979
zend_coroutine_switch_handlers_vector_t *switch_handlers;
983980
};
984981

985-
/**
986-
* zend_future_t structure represents a future result container.
987-
* It inherits from zend_async_event_t to participate in the event system.
988-
*/
989-
struct _zend_future_s {
990-
zend_async_event_t event; /* Event inheritance (first member) */
991-
zval result; /* Result value (UNDEF = pending) */
992-
zend_object *exception; /* Exception object (NULL = no error) */
993-
994-
/* Debug information */
995-
zend_string *filename; /* Creation file */
996-
uint32_t lineno; /* Creation line */
997-
zend_string *resolved_filename; /* Resolution file */
998-
uint32_t resolved_lineno; /* Resolution line */
999-
1000-
/* Resolution method */
1001-
zend_future_resolve_t resolve;
1002-
};
1003-
1004-
/**
1005-
* zend_async_channel_t structure represents a communication channel.
1006-
* It inherits from zend_async_event_t to participate in the event system.
1007-
*/
1008-
struct _zend_async_channel_s {
1009-
zend_async_event_t event; /* Event inheritance (first member) */
1010-
1011-
/* Debug information */
1012-
zend_string *filename; /* Creation file */
1013-
uint32_t lineno; /* Creation line */
1014-
1015-
/* Channel-specific method pointers */
1016-
zend_channel_send_t send; /* Send method */
1017-
zend_channel_receive_t receive; /* Receive method */
1018-
};
1019-
1020982
/**
1021983
* The macro evaluates to TRUE if the coroutine is in a waiting state —
1022984
* either waiting for events or waiting in the execution queue.
@@ -1103,6 +1065,42 @@ struct _zend_async_context_s {
11031065
zend_async_context_dispose_t dispose;
11041066
};
11051067

1068+
///////////////////////////////////////////////////////////////
1069+
/// Future
1070+
///////////////////////////////////////////////////////////////
1071+
1072+
/**
1073+
* zend_future_t structure represents a future result container.
1074+
* It inherits from zend_async_event_t to participate in the event system.
1075+
*/
1076+
struct _zend_future_s {
1077+
zend_async_event_t event; /* Event inheritance (first member) */
1078+
zval result; /* Result value */
1079+
zend_object *exception; /* Exception object (NULL = no error) */
1080+
};
1081+
1082+
#define ZEND_FUTURE_F_THREAD_SAFE (1u << 10)
1083+
#define ZEND_FUTURE_F_IGNORE (1u << 11)
1084+
1085+
///////////////////////////////////////////////////////////////
1086+
/// Channel
1087+
///////////////////////////////////////////////////////////////
1088+
1089+
/**
1090+
* zend_async_channel_t structure represents a communication channel.
1091+
* It inherits from zend_async_event_t to participate in the event system.
1092+
*/
1093+
struct _zend_async_channel_s {
1094+
zend_async_event_t event; /* Event inheritance (first member) */
1095+
1096+
/* Channel-specific method pointers */
1097+
zend_channel_send_t send; /* Send method */
1098+
zend_channel_receive_t receive; /* Receive method */
1099+
};
1100+
1101+
#define ZEND_ASYNC_CHANNEL_F_THREAD_SAFE (1u << 10)
1102+
1103+
11061104
///////////////////////////////////////////////////////////////
11071105
/// Global Macros
11081106
///////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)