Crate entangled[][src]

Entangled provides 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 spawning futures from the calling thread, which have access to the stack of the calling thread and joins them after they have completed.

Example

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

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);

Re-exports

pub use async_executor::Task;

Structs

Scope

Scopes the execution of futures.

ThreadPool

A thread pool for executing futures.

ThreadPoolDescriptor

Describes how a ThreadPool should be created.