Skip to content

Implemented some experimental event loops with nextTick() support. #234

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

Merged
merged 24 commits into from
Dec 5, 2013
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
db41311
Implemented some experimental event loops with nextTick() support.
jmalloc Nov 13, 2013
cbe3664
Trying installion of ext-event in travis configuration.
jmalloc Nov 13, 2013
f0fb0af
Changed StreamSelectNextTickLoop to use existing Timers implementation.
jmalloc Nov 13, 2013
abbb05d
Removed AbstractNextTickLoop::streamKey()
jmalloc Nov 13, 2013
75b496a
Abstracted the actual next-tick queue into it's own class.
jmalloc Nov 13, 2013
35e4cd0
Reduced method dispatching somewhat.
jmalloc Nov 13, 2013
7fac0d3
Favour isset() over array_key_exists().
jmalloc Nov 13, 2013
514d05b
Removed NextTickLoopInterface, AbstractNextTickLoop and renamed Strea…
jmalloc Nov 14, 2013
85d0bcc
Various changes as per comments in PR.
jmalloc Nov 15, 2013
93da5ec
Fixed and added test-case for next-tick events added by timers.
jmalloc Nov 15, 2013
dc43f53
Removed some unnecessary left-overs.
jmalloc Nov 15, 2013
a8af7bc
Use status for unused parameters.
jmalloc Nov 15, 2013
18a00c7
Added nextTick() support to LibEventLoop (based off ExtEventLoop).
jmalloc Nov 18, 2013
3bba9e4
Renamed NextTick namespace to Tick + enable ExtEventLoop tests for Li…
jmalloc Nov 18, 2013
74131f7
Added nextTick() support to LibEvLoop.
jmalloc Nov 18, 2013
17c378f
Use 'inheritdoc' for methods from LoopInterface.
jmalloc Nov 21, 2013
7d7dd65
Code style.
jmalloc Nov 21, 2013
a8fe3cf
Added callable type-hint to LoopInterface, use SplQueue::isEmpty().
jmalloc Nov 21, 2013
0ac0305
Simplification of LibEvLoop.
jmalloc Nov 21, 2013
3ac92ee
Added @-operator error suppression to EventBase::loop() calls.
jmalloc Nov 21, 2013
87d2207
Code style.
jmalloc Nov 21, 2013
cae3165
Add 1µs minimum interval to Timer, and remove Timers::MIN_RESOLUTION.
jmalloc Nov 22, 2013
c0cd613
Changed protected methods in event-loop implementations to private.
jmalloc Dec 1, 2013
edc337e
Removed ExtEventLoop
jmalloc Dec 4, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed and added test-case for next-tick events added by timers.
  • Loading branch information
jmalloc committed Nov 15, 2013
commit 93da5ec7c889f19d818436479696c40ceff1406e
6 changes: 5 additions & 1 deletion src/React/EventLoop/StreamSelectLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,12 @@ public function run()

$this->timers->tick();

// Timers have placed more items on the next-tick queue ...
if (!$this->nextTickQueue->isEmpty()) {
$timeout = 0;

// There is a pending timer, only block until it is due ...
if ($scheduledAt = $this->timers->getFirst()) {
} elseif ($scheduledAt = $this->timers->getFirst()) {

if (0 > $timeout = $scheduledAt - $this->timers->getTime()) {
$timeout = 0;
Expand Down
18 changes: 18 additions & 0 deletions tests/React/Tests/EventLoop/AbstractLoopTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,24 @@ function () {
$this->loop->run();
}

public function testNextTickEventGeneratedByTimer()
{
$this->loop->addTimer(
0.001,
function () {
$this->loop->nextTick(
function () {
echo 'next-tick' . PHP_EOL;
}
);
}
);

$this->expectOutputString('next-tick' . PHP_EOL);

$this->loop->run();
}

private function assertRunFasterThan($maxInterval)
{
$start = microtime(true);
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy