entangled

Crates.ioentangled
lib.rsentangled
version1.3.0
sourcesrc
created_at2021-03-27 10:40:17.941395
updated_at2021-04-02 18:37:22.899632
descriptionA simple fork-join task executor.
homepagehttps://github.com/hasenbanck/entangled
repositoryhttps://github.com/hasenbanck/entangled
max_upload_size
id374169
size33,558
Nils Hasenbanck (hasenbanck)

documentation

README

entangled

Latest version Documentation ZLIB MIT Apache

Entangled provides a thread pool based on the async-executor crate to spawn async futures on.

It's main selling point is the "scoped spawn" functionality, which is essentially forking tasks from the main thread, which have access to the stack of the main thread and joins them after they have completed.

Example

use entangled::*;
use std::sync::atomic::*;

fn main() {
    let pool = ThreadPool::new(
        ThreadPoolDescriptor::default()
    ).expect("can't create task pool");

    let counter = AtomicI32::new(0);
    let ref_counter = &counter;

    pool.scope(|scope| {
        for _ in 0..10 {
            scope.spawn(async {
                ref_counter.fetch_add(1, Ordering::Relaxed);
            });
        }
    });

    assert_eq!(counter.load(Ordering::Relaxed), 10);
}

Credits

Originally based on bevy_tasks crate, but was completely rewritten with version 1.2

License

Licensed under Apache-2.0 or MIT or ZLIB.

Commit count: 7

cargo fmt