pub struct ThreadPool(/* private fields */);
Available on crate feature
multi-thread
only.Expand description
A thread pool for processing operations asynchronously.
Currently only used in AsyncPoolSink
.
§Examples
use spdlog::{sink::AsyncPoolSink, ThreadPool};
let thread_pool = Arc::new(ThreadPool::new()?);
let async_pool_sink = AsyncPoolSink::builder()
.sink(underlying_sink)
.thread_pool(thread_pool)
.build()?;
Implementations§
Source§impl ThreadPool
impl ThreadPool
Sourcepub fn builder() -> ThreadPoolBuilder
pub fn builder() -> ThreadPoolBuilder
Gets a builder of ThreadPool
with default parameters:
Parameter | Default Value |
---|---|
capacity | 8192 (may change in the future) |
on_thread_spawn | None |
on_thread_finish | None |
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Constructs a ThreadPool
with default parameters (see documentation of
ThreadPool::builder
).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ThreadPool
impl !RefUnwindSafe for ThreadPool
impl Send for ThreadPool
impl Sync for ThreadPool
impl Unpin for ThreadPool
impl !UnwindSafe for ThreadPool
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