-
-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PeclEvLoop: Add new PeclEvLoop (PECL ext-ev) #25
Conversation
The existing libev driver seems to function only with a non-official, out of date libev extension for PHP. This PeclEvLoop class is a very similar clone of the LibEvLoop library but for the officially documented libev extension. Changes are mostly to constants and function parameter order.
Will give it a run but looks good on first sight 👍 |
👍 on getting this in! Admittedly I haven't looked into testing this either so far.. Any instructions on how to set this up? Bonus points for adding this to the |
Just an FYI this was already implemented in #12 , there are some issues currently with the extension in regards to segfaulting which is keeping it from moving forward. |
Any movement on this or #12? There have been 2 more 'stable' releases to pecl-ev since the last comments on these two issues. |
@giggsey I believe the branch is mostly working but I cannot test it because of problems with AbstractLoopTest class. The class uses a temporary memory stream to do its reading and writing, but libraries outside of core ZF cannot use polling on such a stream because it is not a real file handle. Another problem is that the test assumes callbacks happen synchronously, and this isn't the case with pecl's LibEv. When you run the loop one time with libev the method will return control to PHP immediately. The only way to wait for control until callbacks finish is to completely hand-off program control forever until all callbacks have unregistered themselves from the libev loop. Phpunit's expectOutputString is used a lot in the abstract test class and libev's execution of callbacks is not guaranteed by the time the test method finishes. There is a segfault after phpunit runs, but this could be related to shutdown clean-up and doesn't seem to disrupt the tests. |
Any progress on this? This maintained pecl extension has been updated to work with php 7 in a development version (pecl install ev-dev), whereas the developer of the existing php-libev package has indicated that php 7 support is unlikely to happen anytime soon. This is a unfortunate, considering that libev is supposed to be a modern slimmer version of libevent... but we're stuck using libevent on php 7 at the moment. |
Any progress? Should be cool to merge, this is the only solution ATM for libev+php7. |
|
||
public function __construct() | ||
{ | ||
$this->loop = EvLoop::defaultLoop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not new \EvLoop()
here?
public function cancelTimer(TimerInterface $timer) | ||
{ | ||
if (isset($this->timerEvents[$timer])) { | ||
$event = $this->timerEvents->get($timer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$event = $this->timerEvents[$timer];
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, there's no get method on SplObjectStorage: http://php.net/manual/en/class.splobjectstorage.php
I can't do any more work on this until react's unit test class is cleaned up wrt my previous comments. It's basically impossible to test any async loop drivers. AFAIK this extension is good, but it's not testable and I can't make it testable. |
@markkimsal I share your concern and I've love to get this in. What do you suggest we do here? Technically, you're not required to extend the As long as we make sure the loop is fully tested and any differences to existing loops are properly covered and documented(!), I'm fine with either 👍 |
I'd like to make this actionable What is the current status here? How is this related to #12? Is there still interest in this ticket or can either be closed? |
Thank you for working on this and helping push this forward! This is kind of an old PR and it looks like #97 is the most up to date version of this feature, so I'm closing this one in favor of the newer PR This should help us focusing on shipping this in a future version 👍 |
When I download the pecl extension for PHP, the LibEvLoop loop driver is not instantiated and used. The pecl extension documented on php.net does not match the code in LibEvLoop.
This feature branch adds a new driver - PeclEvLoop - that matches the documented libev pecl extension on php.net. The code closely resembles LibEvLoop except some class names and parameter orders are changed.