All Projects → fiberphp → Fiber Ext

fiberphp / Fiber Ext

Licence: other
stackful-coroutines for PHP

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Fiber Ext

Libfiber
The high performance coroutine library for Linux/FreeBSD/MacOS/Windows, supporting select/poll/epoll/kqueue/iocp/windows GUI
Stars: ✭ 519 (+265.49%)
Mutual labels:  coroutines, coroutine, fiber
Minicoro
Single header asymmetric stackful cross-platform coroutine library in pure C.
Stars: ✭ 164 (+15.49%)
Mutual labels:  coroutines, coroutine, fiber
Jacob
A lightweight library to provide coroutines in Java
Stars: ✭ 14 (-90.14%)
Mutual labels:  coroutines, coroutine
DeezerClone
This Application using Dagger Hilt, Coroutines, Flow, Jetpack (Room, ViewModel, LiveData),Navigation based on MVVM architecture.
Stars: ✭ 81 (-42.96%)
Mutual labels:  coroutines, coroutine
Fibjs
JavaScript on Fiber (built on Chrome's V8 JavaScript engine)
Stars: ✭ 2,880 (+1928.17%)
Mutual labels:  coroutine, fiber
Mvvmtemplate
An Android Template with MVVM and Clean Architecture
Stars: ✭ 182 (+28.17%)
Mutual labels:  coroutines, coroutine
YACLib
Yet Another Concurrency Library
Stars: ✭ 193 (+35.92%)
Mutual labels:  fiber, coroutine
Tina
Tina is a teeny tiny, header only, coroutine and job library.
Stars: ✭ 125 (-11.97%)
Mutual labels:  coroutines, fiber
Coroutine
C++ 20 Coroutines in Action (Helpers + Test Code Examples)
Stars: ✭ 262 (+84.51%)
Mutual labels:  coroutines, coroutine
State Threads
Light-weight thread library, coroutine or c++ goroutine , patched for SRS.
Stars: ✭ 500 (+252.11%)
Mutual labels:  coroutines, fiber
Swiftcoroutine
Swift coroutines for iOS, macOS and Linux.
Stars: ✭ 690 (+385.92%)
Mutual labels:  coroutines, coroutine
Tascalate Javaflow
Continuations / CoRoutines for Java 1.5 - 11, build tools, CDI support. This project is based on completely re-worked Apache Jakarta Commons JavaFlow library.
Stars: ✭ 51 (-64.08%)
Mutual labels:  coroutines, coroutine
Unityfx.async
Asynchronous operations (promises) for Unity3d.
Stars: ✭ 143 (+0.7%)
Mutual labels:  coroutines, coroutine
ProtoPromise
Robust and efficient library for management of asynchronous operations in C#/.Net.
Stars: ✭ 20 (-85.92%)
Mutual labels:  coroutines, coroutine
Co
Art of C++. Flag, logging, unit-test, json, go-style coroutine and more.
Stars: ✭ 2,264 (+1494.37%)
Mutual labels:  coroutine, coroutines
Concurrencpp
Modern concurrency for C++. Tasks, executors, timers and C++20 coroutines to rule them all
Stars: ✭ 340 (+139.44%)
Mutual labels:  coroutines, coroutine
Sylar
C++高性能分布式服务器框架,webserver,websocket server,自定义tcp_server(包含日志模块,配置模块,线程模块,协程模块,协程调度模块,io协程调度模块,hook模块,socket模块,bytearray序列化,http模块,TcpServer模块,Websocket模块,Https模块等, Smtp邮件模块, MySQL, SQLite3, ORM,Redis,Zookeeper)
Stars: ✭ 895 (+530.28%)
Mutual labels:  coroutine, fiber
Flow
C# co-routine Kernel for .Net. Includes Futures, Barriers, Triggers, Timers and Groups. Gamasutra article provides extra documentation.
Stars: ✭ 59 (-58.45%)
Mutual labels:  coroutines, coroutine
Awesomegithub
🔥Android Github客户端,基于组件化开发,支持账户密码与认证登陆。使用Kotlin语言进行开发,项目架构是基于JetPack&DataBinding的MVVM;项目中使用了Arouter、Retrofit、Coroutine、Glide、Dagger与Hilt等流行开源技术。
Stars: ✭ 128 (-9.86%)
Mutual labels:  coroutine
Swoole Docker
See: https://github.com/swoole/docker-swoole
Stars: ✭ 132 (-7.04%)
Mutual labels:  coroutine

PHP-Fiber

Build Status

Fibers are primitives for implementing light weight cooperative concurrency in PHP. Basically they are a means of creating Closure that can be paused and resumed. The scheduling of fiber must be done by the programmer and not the VM.

More details can be found at this RFC, and this PR.

Install

php-fiber only support PHP 7.2+. If you use PHP-7.2, you must compile your PHP from source and this patch is needed. As that patch has been merged at 6780c74, php-fiber will work with PHP-7.3(may release in 2018).

And then, you need do this

patch -b -p1 < zend_fiber.patch # for PHP-7.2

phpize
./configure
make
sudo make install

Usage

<?php
function sub1()
{
    // yield from sub call
    return Fiber::yield(1);
}
$fiber = new Fiber(function ($a, $b) {
    $c = Fiber::yield($a + $b);

    $d = sub1();
    return $d.$c;
});

echo $fiber->resume(1, 2);     // echo 3
echo $fiber->resume("world");  // echo 1
echo $fiber->resume("hello "); // echo "hello world"

Each Fiber has a separate 4k stack. You can use the fiber.stack_size ini option to change the default stack size. You can also use the second argument of Fiber::__construct to set the stack size on fly.

Known issues

Fiber::yield cannot be used in internal callback

The following code will cause a coredump.

<?php
$f = new Fiber(function () {
    array_map(function ($i) {
        Fiber::yield($i);
    }, [1,2]);
});

$f->resume();

Roadmap

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].