File tree 2 files changed +34
-1
lines changed
tests/swoole_coroutine_scheduler
2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ ZEND_END_ARG_INFO()
130
130
bool PHPCoroutine::active = false;
131
131
uint64_t PHPCoroutine::max_num = SW_DEFAULT_MAX_CORO_NUM;
132
132
php_coro_task PHPCoroutine::main_task = {0 };
133
-
133
+ pthread_t PHPCoroutine::schedule_thread_id;
134
134
bool PHPCoroutine::schedule_thread_running = false ;
135
135
136
136
static zend_bool* zend_vm_interrupt = nullptr ;
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ swoole_coroutine_scheduler: hook_flags
3
+ --SKIPIF--
4
+ <?php require __DIR__ . '/../include/skipif.inc ' ; ?>
5
+ --FILE--
6
+ <?php
7
+ require __DIR__ . '/../include/bootstrap.php ' ;
8
+
9
+ $ sch = scheduler ();
10
+
11
+ $ sch ->set (['hook_flags ' => SWOOLE_HOOK_ALL ,]);
12
+
13
+ $ sch ->add (function ($ t , $ n ) {
14
+ sleep ($ t );
15
+ echo "$ n \n" ;
16
+ }, 0.2 , 'A ' );
17
+
18
+ $ sch ->add (function ($ t , $ n ) {
19
+ sleep ($ t );
20
+ echo "$ n \n" ;
21
+ }, 0.1 , 'B ' );
22
+
23
+ $ sch ->add (function () {
24
+ var_dump (Co::getCid ());
25
+ });
26
+
27
+ $ sch ->start ();
28
+
29
+ ?>
30
+ --EXPECTF--
31
+ int(%d)
32
+ B
33
+ A
You can’t perform that action at this time.
0 commit comments