pub struct SharedWorkerThreadSpawner<T>where
T: Send + 'static,{ /* private fields */ }
Expand description
Spawns worker threads that share multiple dispatchers, with each thread handling subscriptions from all configured dispatchers using different handlers per dispatcher type.
Implementations§
Sourcepub fn set_cores(self, cores: Vec<CoreId>) -> Self
pub fn set_cores(self, cores: Vec<CoreId>) -> Self
Sets the CPU cores that worker threads will be pinned to.
Sourcepub fn set_batch_size(self, batch_size: usize) -> Self
pub fn set_batch_size(self, batch_size: usize) -> Self
Sets the batch size for processing messages.
Sourcepub fn add_dispatcher<F>(
self,
dispatcher: Arc<ChannelDispatcher<T>>,
handler: F,
) -> Self
pub fn add_dispatcher<F>( self, dispatcher: Arc<ChannelDispatcher<T>>, handler: F, ) -> Self
Adds a dispatcher-handler pair. Each dispatcher’s subscriptions will be processed by its corresponding handler.
Sourcepub fn run(self) -> SharedWorkerHandle<T>
pub fn run(self) -> SharedWorkerHandle<T>
Spawns worker threads on the configured cores. Each thread processes subscriptions from all dispatchers using a select operation to handle whichever channel has data available. Returns a handle for managing the worker group and uses a barrier to ensure all threads are ready.
Trait Implementations§
Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more