Suppose we have a internal Coroutine class and it has a resume() method. In order to resume the coroutine, we have to call the resume() function.
As the resume function is a internal method defined in c, we need call zend_execute_ex(backuped_execute_data) to resume the zend execution. If we need to pause the coroutine, we set the EG(vm_interrupt) and interrupt_function, and switch the execute data and stack. The zend vm will execute the old online. However, we will never see the resume() method returned and never get its return value. > On 1 Nov 2017, at 17:14, Dmitry Stogov <[email protected]> wrote: > > after zend_interrupt_function() callback VM continues execution using > EG(current_execute_data). > callback may modify it in any way (e.g. unwind stack, or switch to another > co-routine or continuation). > > Thanks. Dmitry. > From: Haitao Lv <[email protected]> > Sent: Wednesday, November 1, 2017 11:54:54 AM > To: Dmitry Stogov > Cc: PHP Internals > Subject: Re: [PHP-DEV] RFC - Zend VM Pause API > > It seems that set EG(vm_interrupt) to 1 could not stop the vm execution but > only execute the interrupt_function and continue the current execution. > > However, my RFC propose to stop the current execution. > >> On 1 Nov 2017, at 16:07, Dmitry Stogov <[email protected]> wrote: >> >> Hi, >> >> It should be possible do similar things using EG(vm_interrupt) and >> zend_interrupt_function() callback (introduced in php-7.1) >> ext/pcntl implements asynchronous signal handling using this. >> >> Thanks. Dmitry. >> From: Haitao Lv <[email protected]> >> Sent: Wednesday, November 1, 2017 4:19:07 AM >> To: PHP Internals >> Subject: [PHP-DEV] RFC - Zend VM Pause API >> >> Hi, internals, >> >> I propose to introduce a new zend vm pause api, and here is the RPF >> >> https://wiki.php.net/rfc/zend-vm-pause-api >> >> Please gave your comment. >> >> Thank you. >> >> >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
