pub struct ThreadPerTaskExecutorService { /* private fields */ }Expand description
Managed service that runs every accepted task on a dedicated OS thread.
The service has no queue: accepted tasks start immediately on their own thread. Shutdown prevents later submissions but cannot forcefully stop running OS threads.
Implementations§
Source§impl ThreadPerTaskExecutorService
impl ThreadPerTaskExecutorService
Trait Implementations§
Source§impl Clone for ThreadPerTaskExecutorService
impl Clone for ThreadPerTaskExecutorService
Source§fn clone(&self) -> ThreadPerTaskExecutorService
fn clone(&self) -> ThreadPerTaskExecutorService
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl ExecutorService for ThreadPerTaskExecutorService
impl ExecutorService for ThreadPerTaskExecutorService
Source§fn submit<T, E>(&self, task: T) -> Result<(), SubmissionError>
fn submit<T, E>(&self, task: T) -> Result<(), SubmissionError>
Accepts a runnable and starts it on a dedicated OS thread.
§Parameters
task- Runnable to execute on a new OS thread.
§Returns
Ok(()) if the runnable was accepted.
§Errors
Returns SubmissionError::Shutdown if shutdown has already been
requested before the task is accepted.
Source§fn submit_callable<C, R, E>(
&self,
task: C,
) -> Result<Self::ResultHandle<R, E>, SubmissionError>
fn submit_callable<C, R, E>( &self, task: C, ) -> Result<Self::ResultHandle<R, E>, SubmissionError>
Accepts a callable and starts it on a dedicated OS thread.
§Parameters
task- Callable to execute on a new OS thread.
§Returns
A TaskHandle for the accepted task.
§Errors
Returns SubmissionError::Shutdown if shutdown has already been
requested before the task is accepted.
Source§fn submit_tracked_callable<C, R, E>(
&self,
task: C,
) -> Result<Self::TrackedHandle<R, E>, SubmissionError>
fn submit_tracked_callable<C, R, E>( &self, task: C, ) -> Result<Self::TrackedHandle<R, E>, SubmissionError>
Accepts a callable and starts it with a tracked handle.
Source§fn stop(&self) -> StopReport
fn stop(&self) -> StopReport
Stops accepting new tasks and reports currently running work.
Running OS threads cannot be forcefully stopped by this service.
§Returns
A report with zero queued tasks, the observed active thread count, and zero cancelled tasks.
Source§fn lifecycle(&self) -> ExecutorServiceLifecycle
fn lifecycle(&self) -> ExecutorServiceLifecycle
Returns the current lifecycle state.
Source§fn wait_termination(&self)
fn wait_termination(&self)
Blocks until all accepted tasks complete after shutdown or stop.
This method blocks the current thread on a condition variable. Calling
it while the service is still running will wait until another thread
calls Self::shutdown or Self::stop and all accepted OS-thread
tasks have completed.