xref: /ext-fiber/php_fiber.h (revision ff0c5867)
1 /*
2   +--------------------------------------------------------------------+
3   | ext-fiber                                                          |
4   +--------------------------------------------------------------------+
5   | Redistribution and use in source and binary forms, with or without |
6   | modification, are permitted provided that the conditions mentioned |
7   | in the accompanying LICENSE file are met.                          |
8   +--------------------------------------------------------------------+
9   | Authors: Aaron Piotrowski <aaron@trowski.com>                      |
10   |          Martin Schröder <m.schroeder2007@gmail.com>               |
11   +--------------------------------------------------------------------+
12 */
13 
14 #ifndef PHP_FIBER_H
15 #define PHP_FIBER_H
16 
17 #include "php.h"
18 #include "fiber.h"
19 
20 #if PHP_VERSION_ID >= 80100 || PHP_VERSION_ID < 80000
21 # error "ext-fiber is only compatible with PHP 8.0.x"
22 #endif
23 
24 extern zend_module_entry fiber_module_entry;
25 #define phpext_fiber_ptr &fiber_module_entry
26 
27 #define PHP_FIBER_VERSION "0.1.0"
28 
29 #if defined(ZTS) && defined(COMPILE_DL_FIBER)
30 ZEND_TSRMLS_CACHE_EXTERN()
31 #endif
32 
33 ZEND_BEGIN_MODULE_GLOBALS(fiber)
34 	/* Active fiber, NULL when in main thread. */
35 	zend_fiber *current_fiber;
36 
37 	/* Default fiber C stack size. */
38 	zend_long stack_size;
39 
40 	/* If a fatal error occurs in a fiber, this is used to save the error while switching to {main}. */
41 	zend_fiber_error *error;
42 
43 	/* ZEND_CATCH handler that may be declared by another extension. */
44 	user_opcode_handler_t catch_handler;
45 
46 ZEND_END_MODULE_GLOBALS(fiber)
47 
48 extern ZEND_DECLARE_MODULE_GLOBALS(fiber)
49 
50 #define FIBER_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(fiber, v)
51 
52 #endif
53 
54 /*
55  * vim: sw=4 ts=4
56  * vim600: fdm=marker
57  */
58