/// Shutdown all pool resources and close all channels.
///
/// Ideally the [`PooledWriter`]s should all have been flushed first, that is up to the user. Any
/// further attempts to send to the [`Pool`] will return an error.
Shutdown all pool resources and close all channels.
Ideally the [`PooledWriter`]s should all have been flushed first, that is up to the user. Any
further attempts to send to the [`Pool`] will return an error.
Shutdown all pool resources and close all channels . Ideally the [ ` PooledWriter ` ] s should all have been flushed first that is up to the user . Any further attempts to send to the [ ` Pool ` ] will return an error .
pub fn stop_pool(&mut self) -> Result<(), PoolError> {
        let compressor_queue = self.compressor_tx.take().unwrap();
        while !compressor_queue.is_empty() {
            // Wait for compression to finish before dropping the sender
        }
        drop(compressor_queue);
        // Shutdown called to force writers to start checking their receivers for disconnection / empty
        drop(self.shutdown_tx.take());
        // Drop the copy of the writer senders that the pool holds
        // TODO: the pool probably doesn't need these anyways.
        self.writers_txs.take().into_iter().enumerate().for_each(|(i, w)| {
            // Wait for writing to finish
            drop(w);
        });
        // Wait on the pool thread to finish and pull any errors from it
        match self.pool_handle.take().unwrap().join() {
            Ok(result) => result,
            Err(e) => std::panic::resume_unwind(e),
        }
    }
pub fn stop_pool ( & mut self ) -> Result < ( ) , PoolError > { let compressor_queue = self . compressor_tx . take ( ) . unwrap ( ) ; while ! compressor_queue . is_empty ( ) { // Wait for compression to finish before dropping the sender } drop ( compressor_queue ) ; // Shutdown called to force writers to start checking their receivers for disconnection / empty drop ( self . shutdown_tx . take ( ) ) ; // Drop the copy of the writer senders that the pool holds // TODO: the pool probably doesn't need these anyways. self . writers_txs . take ( ) . into_iter ( ) . enumerate ( ) . for_each ( | ( i , w ) | { // Wait for writing to finish drop ( w ) ; } ) ; // Wait on the pool thread to finish and pull any errors from it match self . pool_handle . take ( ) . unwrap ( ) . join ( ) { Ok ( result ) => result , Err ( e ) => std :: panic :: resume_unwind ( e ) , } }
Shutdown all pool resources and close all channels.
Shutdown all pool resources and close all channels .
&mut self