Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101822 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7887 invoked from network); 10 Feb 2018 15:45:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Feb 2018 15:45:20 -0000 Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.219 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.219 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.219] ([81.169.146.219:27338] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F6/BA-21403-F831F7A5 for ; Sat, 10 Feb 2018 10:45:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1518277516; s=strato-dkim-0002; d=kelunik.com; h=Content-Type:Cc:To:Subject:Message-ID:Date:From:References: In-Reply-To:X-RZG-CLASS-ID:X-RZG-AUTH; bh=sglfXIJvlQggtIoOZv2Ue4CTm4J7aEaQtXS6cov0eXk=; b=VbuEyilaYgdSTeM7kVCujQUniQkl1+92vlP5C/UEq8U6Nl+VGD30X6oPWFyIILuxr4 UEsUIQif1rMFtHhu/AHV6ySdNR8YVeN+y4PaAamcu620G3F8w0L4grpnLkZkJ1yjXgMh SNfEMm8s0EqCcYxqc2+KLdYBikiABY8pZc31Iz86E0lZdPnIFHNfbzSwES+c6pdn8eQ2 8hlxPSp24AAjkce9LSSazqaxmT8Spjxg6xiBrbfpKfaifIvQpjzlhFjhaqbsBsneC0fm j4c9+sBSKYJNBR/Iz/lyxnqcGEMjVtuap3TBPEV5oqaBf6yuBHHtsdiPHSBF7dZcLVmb oeqw== X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mlsGbEv0XHBzMIJSS+jKTzde5mDb8Db2nURiuycA== X-RZG-CLASS-ID: mo00 Received: by mail-yw0-f175.google.com with SMTP id x62so7200472ywg.11 for ; Sat, 10 Feb 2018 07:45:16 -0800 (PST) X-Gm-Message-State: APf1xPAnV5zc75B/IVZ7G1Qfh85SW1DKnETDSiuWbFKFSP1O+B9M3Yar +7XasQtgo+45S/gpjw/n4VFrBtVo0tZ7/hZw0s8= X-Google-Smtp-Source: AH8x224/0hYfa85WRu1dEDw0fQjxrUz4ZennEArO6xiMfmPYK3vJLyO/QB54teMwq2j5utiD4aK34HgGEhR3g/NBl3k= X-Received: by 10.13.251.129 with SMTP id l123mr4414216ywf.130.1518277516008; Sat, 10 Feb 2018 07:45:16 -0800 (PST) MIME-Version: 1.0 Received: by 10.37.182.201 with HTTP; Sat, 10 Feb 2018 07:45:15 -0800 (PST) In-Reply-To: <60FDAEC8-02A4-4AAE-A5E3-4A119946BEB5@lvht.net> References: <76EBF900-3BE8-4B60-9422-880A9754FCC4@lvht.net> <0DDFDACA-6322-461C-9D57-215E8C7D9CD0@trowski.com> <60FDAEC8-02A4-4AAE-A5E3-4A119946BEB5@lvht.net> Date: Sat, 10 Feb 2018 16:45:15 +0100 X-Gmail-Original-Message-ID: Message-ID: To: =?UTF-8?B?5ZCV5rW35rab?= Cc: Aaron Piotrowski , PHP Internals , Dmitry Stogov Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] Fiber support (again) From: me@kelunik.com (Niklas Keller) >> There would also need to be something that stops the script execution >> as soon as there's no non-suspended Fiber anymore. > > As you pointed out, the main process cannot be a Fiber because it need to > schedule other fibers. The conclusion is wrong. There just needs to be a way to access this fiber, e.g. Fiber::getMain(). >> >> Regarding the internal calls: A core dump / segfault in case of >> Fiber::yield() inside an internal function is unacceptable. It doesn't >> give the user any clue what's wrong. Instead, an exception could be >> thrown from Fiber::yield(), which just bubbles up then. Full support >> for internal functions could be added at a later point then. > > It is impossible to solve this issue before we get a pure stackless Zend VM. > > If this feature can be merged into PHP 7.3, we could introduce a new counter > to record the zend vm nested level. Every time you enter an internal call, > let zend increment the counter, and decrement it when out. > > When we create a fiber, we remember current vm nested level. When zend execute > Fiber::yield,it will throw an error if the current vm nested level is not > equal to the original one. > > This feature cannot be implemented without changing the zend vm code base. You're proposing this as language feature, not as an external extension, so that is entirely fine and actually the reason why this should be in core instead of an external extension. Regards, Niklas