Struct glommio::LocalExecutorPoolBuilder[][src]

pub struct LocalExecutorPoolBuilder { /* fields omitted */ }
Expand description

A factory to configure and create a pool of LocalExecutors.

Configuration methods apply their settings to all LocalExecutors in the pool unless otherwise specified. Methods can be chained on the builder in order to configure it. The Self::on_all_shards method will take ownership of the builder and create a PoolThreadHandles struct which can be used to join the executor threads.

Example

use glommio::{Local, LocalExecutorPoolBuilder};

let handles = LocalExecutorPoolBuilder::new(4)
    .on_all_shards(|| async move {
        let id = Local::id();
        println!("hello from executor {}", id);
    })
    .unwrap();

handles.join_all();

Implementations

Generates the base configuration for spawning a pool of LocalExecutors, from which configuration methods can be chained. The method’s only argument sets the number of LocalExecutors to spawn.

Please see documentation under LocalExecutorBuilder::spin_before_park for details. The setting is applied to all executors in the pool.

Please see documentation under LocalExecutorBuilder::name for details. The setting is applied to all executors in the pool. Note that when a thread is spawned, the name is combined with a hyphen and numeric id (e.g. myname-1) such that each thread has a unique name.

Please see documentation under LocalExecutorBuilder::io_memory for details. The setting is applied to all executors in the pool.

Please see documentation under LocalExecutorBuilder::preempt_timer for details. The setting is applied to all executors in the pool.

This method sets the Placement policy by which LocalExecutors are bound to the machine’s hardware topology (i.e. which CPUs to use). The default is Placement::Unbound.

Spawn a pool of LocalExecutors in a new thread according to the Placement policy, which is Unbound by default.

This method is the pool equivalent of LocalExecutorBuilder::spawn.

The method takes a closure fut_gen which will be called on each new thread to obtain the Future to be executed there.

Panics

The newly spawned thread panics if creating the executor fails. If you need more fine-grained error handling consider initializing those entities manually.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more