Skip to content

Releases: reactphp-parallel/event-loop

2.0.0

09 Feb 12:22
8bd9ec8
Compare
Choose a tag to compare

Fully reworked the event loop public facing API to utilize fibers:

Channels

From:

use parallel\Channel;
use React�ventLoop\Factory;
use ReactParallel�ventLoop�ventLoopBridge;

$loop = Factory::create();
$eventLoopBridge = new EventLoopBridge($loop);

$channel = new Channel(Channel::Infinite);
$eventLoopBridge->observe($channel)->subscribe(function (string $message) {
    echo $message, PHP_EOL;
});

$loop->futureTick(function () use ($channel): void {
    $channel->send('Hello World!');
    $channel->close();
});

$loop->run();

To:

use parallel\Channel;
use React�ventLoop\Loop;
use ReactParallel�ventLoop�ventLoopBridge;
use function React\Async�sync;
use function React\Async�wait;
use function React\Promise\Timer\sleep;

$eventLoopBridge = new EventLoopBridge();

Loop::futureTick(async(static function () use ($eventLoopBridge) {
    /** @var Channel<string> */
    $channel = new Channel(Channel::Infinite);

    Loop::futureTick(async(function () use ($channel): void {
        $channel->send('Hello World!');
        // Don't close the channel right after writing to it,
        // as it will be closed on both ends and the other
        // thread won't receive your message
        await(sleep(1));
        $channel->close();
    }));

    foreach ($eventLoopBridge->observe($channel) as $message) {
        echo $message, PHP_EOL;
    }
}));

Futures

From:

use parallel\Channel;
use React�ventLoop\Factory;
use ReactParallel�ventLoop�ventLoopBridge;
use function parallel
un;

$loop = Factory::create();
$eventLoopBridge = new EventLoopBridge($loop);

$future = run(function (): string {
    return 'Hello World!';
});

$channel = new Channel(Channel::Infinite);
$eventLoopBridge->await($future)->then(function (string $message) {
    echo $message, PHP_EOL;
});

$loop->run();

To:

use React�ventLoop\Loop;
use ReactParallel�ventLoop�ventLoopBridge;
use function parallel
un;
use function React\Async�sync;

$eventLoopBridge = new EventLoopBridge();

Loop::futureTick(async(static function () use ($eventLoopBridge) {
    $future = run(function (): string {
        return 'Hello World!';
    });

    echo $eventLoopBridge->await($future), PHP_EOL;
}));

2.0.0

  • Total issues resolved: 0
  • Total pull requests resolved: 36
  • Total contributors: 3

Dependencies 📦,Enhancement ✨

Dependencies 📦,Feature 🏗

Dependencies 📦

Enhancement ✨

1.2.0

19 Dec 17:28
d50e899
Compare
Choose a tag to compare

Introduces a scaling timer inside the event loop bridge. Making it use less CPU by scaling between 100 and 1000 checks for new events per second.

1.2.0

  • Total issues resolved: 0
  • Total pull requests resolved: 5
  • Total contributors: 2

PHP 🐘,Source 🔮,enhancement

Feature 🏗,PHP 🐘,Source 🔮

Dependencies 📦,PHP 🐘

Dependencies 📦,JSON 👨‍💼,PHP 🐘

1.1.0

17 Nov 21:46
e859517
Compare
Choose a tag to compare

Metrics

Added support for metrics through wyrihaximus/metrics:

use React�ventLoop\Factory;
use ReactParallel�ventLoop�ventLoopBridge;
use ReactParallel�ventLoop\Metrics;
use WyriHaximus\Metrics\Configuration;
use WyriHaximus\Metrics\InMemory\Registry;

$loop = Factory::create();
$eventLoopBridge = (new EventLoopBridge($loop))->withMetrics(Metrics::create(new Registry(Configuration::create())));

1.1.0

CI 🚧,Dependencies 📦,Documentation 📚,JSON 👨‍💼,MarkDown 📝,NEON 🦹‍♂️,PHP 🐘,Source 🔮,Tests 🧪,YAML 🍄

1.0.1

04 Nov 00:52
1.0.1
5070e4e
Compare
Choose a tag to compare
  • Minor bug fix

1.0.0

04 Nov 00:52
1.0.0
ecf5644
Compare
Choose a tag to compare
  • Initial release