[no longer maintained] Scalable, coroutine-based, fibers/green-threads for Rust. (aka MIO COroutines).

Overview

Travis CI Build Status App Veyor Build Status crates.io Gitter Chat
Documentation

mioco

Mioco provides green-threads (aka fibers) like eg. Goroutines in Go, for Rust.

Status

This repo is a complete re-implementation of mioco. The code of previous versions was moved to mioco.pre-0.9.

The goals of new implementation:

  • switch to latest mio version
  • copy all the applicable good ideas from tokio reactor code
  • simplify the approach
    • remove the exposed scheduler
  • model the API to be more like std library, less like mio
  • focus on synchronization primitives first
  • support async file IO (via worker threads)
  • port all the existing mioco features, tests, examples etc.
You might also like...
Rust, but longer

Rusticle Do Rust's short keywords confuse you? Are you tired of Rust not being verbose enough? Or worrying you are not using your new shiny mechanical

Messing around with delimited continuations, fibers, and algebraic effects

A Simple Virtual Machine with Effects Each thread of execution in this VM is called a Fiber. A Fiber is unique, can be sent between threads, but can n

Using fibers to run in-memory code in a different and stealthy way.
Using fibers to run in-memory code in a different and stealthy way.

Description A fiber is a unit of execution that must be manually scheduled by the application rather than rely on the priority-based scheduling mechan

Fast dense evaluation of Green's function kernels in Rust

Fast evaluation of Greens functions in Rust This library allows the fast evaluation of Greens functions and potential sums for Laplace, Helmholtz, and

Simple interoperability between C++ coroutines and asynchronous Rust

cxx-async Overview cxx-async is a Rust crate that extends the cxx library to provide seamless interoperability between asynchronous Rust code using as

Red Light, Green Light is a traditional Korean children's game, popularised by the Squid Game TV series.
Red Light, Green Light is a traditional Korean children's game, popularised by the Squid Game TV series.

Red Light, Green Light Red Light, Green Light is a traditional Korean children's game, popularised by the Squid Game TV series. This project is the di

Cogo is a high-performance library for programming stackful coroutines with which you can easily develop and maintain massive concurrent programs.
Cogo is a high-performance library for programming stackful coroutines with which you can easily develop and maintain massive concurrent programs.

Cogo is a high-performance library for programming stackful coroutines with which you can easily develop and maintain massive concurrent programs.

A simple asynchronous runtime for executing async coroutines in the bevy engine.

Bevy Defer A simple asynchronous runtime for executing async coroutines. Motivation Async rust is incredible for modelling wait centric tasks like cor

Coroutine I/O for Rust

Coroutine I/O Coroutine scheduling with work-stealing algorithm. WARN: Possibly crash because of TLS inline, check https://github.com/zonyitoo/coio-rs

Monad/MonadIO, Handler, Coroutine/doNotation, Functional Programming features for Rust

fpRust Monad, Functional Programming features for Rust Why I love functional programming, Rx-style coding. However it's hard to implement them in Rust

rust stackful coroutine library

May May is a high-performant library for programming stackful coroutines with which you can easily develop and maintain massive concurrent programs. I

Coroutine Library in Rust

coroutine-rs Coroutine library in Rust [dependencies] coroutine = "0.8" Usage Basic usage of Coroutine extern crate coroutine; use std::usize; use co

Coroutine I/O for Rust

Coroutine I/O Coroutine scheduling with work-stealing algorithm. WARN: Possibly crash because of TLS inline, check https://github.com/zonyitoo/coio-rs

This is a maintained rust project that exposes the cpp driver at cpp-driver in a somewhat-sane crate.

cassandra-rs This is a maintained rust project that exposes the cpp driver at https://github.com/datastax/cpp-driver/ in a somewhat-sane crate. For th

cogo rust coroutine database driver (Mysql,Postgres,Sqlite)

cdbc Coroutine Database driver Connectivity.based on cogo High concurrency,based on coroutine No Future'q,Output=*,No async fn, No .await , no Poll*

A collection of Solana-maintained on-chain programs

Solana Program Library The Solana Program Library (SPL) is a collection of on-chain programs targeting the Sealevel parallel runtime. These programs a

Examples of cw20 usage, extracted from cw-plus, maintained by the community

CosmWasm Tokens This is a collection of cw20-related contracts extracted from cw-plus. These serve as examples of what is possible to build and as sta

The OpenTimelineIO crate is maintained by the vfx-rs project

opentimelineio-bind Rust binding for OpenTimelineIO library The OpenTimelineIO crate is maintained by the vfx-rs project Supported Platforms OpenTimel

Gum Program Library, a collection of on chain programs maintained by Gum
Gum Program Library, a collection of on chain programs maintained by Gum

Gum, at its core, is a decentralized social media protocol on Solana. It unbundles traditional social media into Social Legos similar to how Defi unbu

Comments
  • panic with the below test some times

    panic with the below test some times

    RUST_BACKTRACE=1 cargo test tx_inside_rx_inside_mioco

    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
     Running target/debug/deps/mioco-5839952be6ccc31d
    

    running 0 tests

    test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured

     Running target/debug/deps/mpsc-acbd32c7554c8ddd
    

    running 1 test Apr 23 01:07:25.784 DEBG Creating mioco instance, mioco: 0.9.0-pre

    thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Empty', src/libcore/result.rs:859
    note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
    stack backtrace:
       0: <core::result::Result<T, E>>::unwrap
       1: mpsc::tx_inside_rx_inside_mioco::{{closure}}
       2: mioco::Fiber::new::{{closure}}::{{closure}}
       3: <std::panic::AssertUnwindSafe<F> as core::ops::FnOnce<()>>::call_once
       4: std::panicking::try::do_call
       5: __rust_maybe_catch_panic
       6: std::panicking::try
       7: std::panic::catch_unwind
       8: mioco::Fiber::new::{{closure}}
       9: <mioco::thunk::Thunk<'a, (), R>>::new::{{closure}}
      10: <F as mioco::thunk::Invoke<A, R>>::invoke
      11: <mioco::thunk::Thunk<'a, A, R>>::invoke
      12: mioco::context_function
    

    test tx_inside_rx_inside_mioco ... ok

    test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured

    opened by tekjar 1
  • Update dependencies

    Update dependencies

    This PR updates the dependencies to newer versions.

    The Context crate version 2 makes all calls unsafe. I therefore just wrapped all calls to Context::new and resume into an unsafe block.

    The PR also removes a the printerrln macro from latency.rs, as it is not needed anymore.

    opened by Sawchord 0
  • mioco fails to build due to

    mioco fails to build due to "can't leak private type"

    We getting this error when compiling mioco on Rust1.24

    private type src::sync::mpsc::ReceiverCore<T> in public interface --> /home/cooldude/.cargo/registry/src/github.com-1ecc6299db9ec823/mioco-0.8.1/src/sync/mpsc.rs:35:5 | 35 | type Raw = ReceiverCore; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type

    error[E0446]: private type src::timer::TimerCore in public interface --> /home/cooldude/.cargo/registry/src/github.com-1ecc6299db9ec823/mioco-0.8.1/src/timer.rs:47:5 | 47 | type Raw = TimerCore; | ^^^^^^^^^^^^^^^^^^^^^ can't leak private type

    error: aborting due to 2 previous errors

    error: Could not compile mioco.

    opened by FlogramMatt 0
  • http-server example seems to hang under ApacheBench

    http-server example seems to hang under ApacheBench

    First off, thanks for mioco!

    Steps to reproduce from b8cc872fa1e5d127b2b4c60cdd133ee7aadd22f2 (macOS 10.12.4, macbook pro with 4 cores):

    $ cargo build --example http-server
    $ target/debug/examples/http-server&
    $ ab http://127.0.0.1:5555/
    
    This is ApacheBench, Version 2.3 <$Revision: 1757674 $>
    Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
    Licensed to The Apache Software Foundation, http://www.apache.org/
    
    Benchmarking 127.0.0.1 (be patient)...apr_pollset_poll: The timeout specified has expired (70007)
    Total of 1 requests completed
    

    Sending single requests via telnet or Chrome works fine. I think it has to do with not closing the connection here: https://github.com/dpc/mioco/blob/master/examples/http-server.rs#L68

    If I add a return Ok(()) there, ab works intermittently. It hangs every few requests.

    opened by rryan 1
Owner
Dawid Ciężarkiewicz
Excuse me, sir, do you have a moment to talk about rewriting everything in our Lord and Savior, Rust programming language?
Dawid Ciężarkiewicz
Monad/MonadIO, Handler, Coroutine/doNotation, Functional Programming features for Rust

fpRust Monad, Functional Programming features for Rust Why I love functional programming, Rx-style coding. However it's hard to implement them in Rust

null 98 Dec 24, 2022
rust stackful coroutine library

May May is a high-performant library for programming stackful coroutines with which you can easily develop and maintain massive concurrent programs. I

Xudong Huang 1.3k Dec 31, 2022
Thread Safe Cache with async loader functions based on tokio-rs

cache-loader-async crates.io The goal of this crate is to provide a thread-safe and easy way to access any data structure which might is stored in a d

ZeroTwo Bot 13 Nov 30, 2022
Zero-cost asynchronous programming in Rust

Zero-cost asynchronous programming in Rust Documentation | Website futures-rs is a library providing the foundations for asynchronous programming in R

The Rust Programming Language 4.7k Jan 1, 2023
Metal IO library for Rust

Mio – Metal IO Mio is a fast, low-level I/O library for Rust focusing on non-blocking APIs and event notification for building high performance I/O ap

Tokio 5.3k Jan 2, 2023
Robyn is an async Python backend server with a runtime written in Rust, btw.

Robyn is an async Python backend server with a runtime written in Rust, btw.

Sanskar Jethi 1.8k Jan 4, 2023
Components of Fornjot that are no longer actively maintained. Pull requests still welcome!

Fornjot - Extra Components About These are extra components from the Fornjot repository, that are no longer actively maintained. Fornjot's goal was to

Hanno Braun 4 Jun 6, 2023
Fegeya Gretea (aka green tea), new generation programming language.

Fegeya Gretea Gretea (aka green tea), new generation programming language. A taste of Gretea's syntax: import tea.green.fmt module hello { fn hel

Ferhat Geçdoğan 13 Sep 28, 2022
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022
Pure Rust library for Apache ZooKeeper built on MIO

rust-zookeeper Zookeeper client written 100% in Rust This library is intended to be equivalent with the official (low-level) ZooKeeper client which sh

Nándor István Krácser 168 Dec 25, 2022