Skip to content

Remove nextTick() and NextTickQueue #30

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 2 commits into from
Feb 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 1 addition & 14 deletions src/ExtEventLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use EventBase;
use EventConfig as EventBaseConfig;
use React\EventLoop\Tick\FutureTickQueue;
use React\EventLoop\Tick\NextTickQueue;
use React\EventLoop\Timer\Timer;
use React\EventLoop\Timer\TimerInterface;
use SplObjectStorage;
Expand All @@ -17,7 +16,6 @@
class ExtEventLoop implements LoopInterface
{
private $eventBase;
private $nextTickQueue;
private $futureTickQueue;
private $timerCallback;
private $timerEvents;
Expand All @@ -31,7 +29,6 @@ class ExtEventLoop implements LoopInterface
public function __construct(EventBaseConfig $config = null)
{
$this->eventBase = new EventBase($config);
$this->nextTickQueue = new NextTickQueue($this);
$this->futureTickQueue = new FutureTickQueue($this);
$this->timerEvents = new SplObjectStorage();

Expand Down Expand Up @@ -153,14 +150,6 @@ public function isTimerActive(TimerInterface $timer)
return $this->timerEvents->contains($timer);
}

/**
* {@inheritdoc}
*/
public function nextTick(callable $listener)
{
$this->nextTickQueue->add($listener);
}

/**
* {@inheritdoc}
*/
Expand All @@ -177,12 +166,10 @@ public function run()
$this->running = true;

while ($this->running) {
$this->nextTickQueue->tick();

$this->futureTickQueue->tick();

$flags = EventBase::LOOP_ONCE;
if (!$this->running || !$this->nextTickQueue->isEmpty() || !$this->futureTickQueue->isEmpty()) {
if (!$this->running || !$this->futureTickQueue->isEmpty()) {
$flags |= EventBase::LOOP_NONBLOCK;
} elseif (!$this->streamEvents && !$this->timerEvents->count()) {
break;
Expand Down
15 changes: 1 addition & 14 deletions src/LibEvLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use libev\IOEvent;
use libev\TimerEvent;
use React\EventLoop\Tick\FutureTickQueue;
use React\EventLoop\Tick\NextTickQueue;
use React\EventLoop\Timer\Timer;
use React\EventLoop\Timer\TimerInterface;
use SplObjectStorage;
Expand All @@ -18,7 +17,6 @@
class LibEvLoop implements LoopInterface
{
private $loop;
private $nextTickQueue;
private $futureTickQueue;
private $timerEvents;
private $readEvents = [];
Expand All @@ -28,7 +26,6 @@ class LibEvLoop implements LoopInterface
public function __construct()
{
$this->loop = new EventLoop();
$this->nextTickQueue = new NextTickQueue($this);
$this->futureTickQueue = new FutureTickQueue($this);
$this->timerEvents = new SplObjectStorage();
}
Expand Down Expand Up @@ -157,14 +154,6 @@ public function isTimerActive(TimerInterface $timer)
return $this->timerEvents->contains($timer);
}

/**
* {@inheritdoc}
*/
public function nextTick(callable $listener)
{
$this->nextTickQueue->add($listener);
}

/**
* {@inheritdoc}
*/
Expand All @@ -181,12 +170,10 @@ public function run()
$this->running = true;

while ($this->running) {
$this->nextTickQueue->tick();

$this->futureTickQueue->tick();

$flags = EventLoop::RUN_ONCE;
if (!$this->running || !$this->nextTickQueue->isEmpty() || !$this->futureTickQueue->isEmpty()) {
if (!$this->running || !$this->futureTickQueue->isEmpty()) {
$flags |= EventLoop::RUN_NOWAIT;
} elseif (!$this->readEvents && !$this->writeEvents && !$this->timerEvents->count()) {
break;
Expand Down
15 changes: 1 addition & 14 deletions src/LibEventLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Event;
use EventBase;
use React\EventLoop\Tick\FutureTickQueue;
use React\EventLoop\Tick\NextTickQueue;
use React\EventLoop\Timer\Timer;
use React\EventLoop\Timer\TimerInterface;
use SplObjectStorage;
Expand All @@ -18,7 +17,6 @@ class LibEventLoop implements LoopInterface
const MICROSECONDS_PER_SECOND = 1000000;

private $eventBase;
private $nextTickQueue;
private $futureTickQueue;
private $timerCallback;
private $timerEvents;
Expand All @@ -32,7 +30,6 @@ class LibEventLoop implements LoopInterface
public function __construct()
{
$this->eventBase = event_base_new();
$this->nextTickQueue = new NextTickQueue($this);
$this->futureTickQueue = new FutureTickQueue($this);
$this->timerEvents = new SplObjectStorage();

Expand Down Expand Up @@ -161,14 +158,6 @@ public function isTimerActive(TimerInterface $timer)
return $this->timerEvents->contains($timer);
}

/**
* {@inheritdoc}
*/
public function nextTick(callable $listener)
{
$this->nextTickQueue->add($listener);
}

/**
* {@inheritdoc}
*/
Expand All @@ -185,12 +174,10 @@ public function run()
$this->running = true;

while ($this->running) {
$this->nextTickQueue->tick();

$this->futureTickQueue->tick();

$flags = EVLOOP_ONCE;
if (!$this->running || !$this->nextTickQueue->isEmpty() || !$this->futureTickQueue->isEmpty()) {
if (!$this->running || !$this->futureTickQueue->isEmpty()) {
$flags |= EVLOOP_NONBLOCK;
} elseif (!$this->streamEvents && !$this->timerEvents->count()) {
break;
Expand Down
10 changes: 0 additions & 10 deletions src/LoopInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,6 @@ public function cancelTimer(TimerInterface $timer);
*/
public function isTimerActive(TimerInterface $timer);

/**
* Schedule a callback to be invoked on the next tick of the event loop.
*
* Callbacks are guaranteed to be executed in the order they are enqueued,
* before any timer or stream events.
*
* @param callable $listener The callback to invoke.
*/
public function nextTick(callable $listener);

/**
* Schedule a callback to be invoked on a future tick of the event loop.
*
Expand Down
17 changes: 2 additions & 15 deletions src/StreamSelectLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace React\EventLoop;

use React\EventLoop\Tick\FutureTickQueue;
use React\EventLoop\Tick\NextTickQueue;
use React\EventLoop\Timer\Timer;
use React\EventLoop\Timer\TimerInterface;
use React\EventLoop\Timer\Timers;
Expand All @@ -15,7 +14,6 @@ class StreamSelectLoop implements LoopInterface
{
const MICROSECONDS_PER_SECOND = 1000000;

private $nextTickQueue;
private $futureTickQueue;
private $timers;
private $readStreams = [];
Expand All @@ -26,7 +24,6 @@ class StreamSelectLoop implements LoopInterface

public function __construct()
{
$this->nextTickQueue = new NextTickQueue($this);
$this->futureTickQueue = new FutureTickQueue($this);
$this->timers = new Timers();
}
Expand Down Expand Up @@ -132,14 +129,6 @@ public function isTimerActive(TimerInterface $timer)
return $this->timers->contains($timer);
}

/**
* {@inheritdoc}
*/
public function nextTick(callable $listener)
{
$this->nextTickQueue->add($listener);
}

/**
* {@inheritdoc}
*/
Expand All @@ -156,14 +145,12 @@ public function run()
$this->running = true;

while ($this->running) {
$this->nextTickQueue->tick();

$this->futureTickQueue->tick();

$this->timers->tick();

// Next-tick or future-tick queues have pending callbacks ...
if (!$this->running || !$this->nextTickQueue->isEmpty() || !$this->futureTickQueue->isEmpty()) {
// Future-tick queue has pending callbacks ...
if (!$this->running || !$this->futureTickQueue->isEmpty()) {
$timeout = 0;

// There is a pending timer, only block until it is due ...
Expand Down
57 changes: 0 additions & 57 deletions src/Tick/NextTickQueue.php

This file was deleted.

Loading
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