Trait AcknowledgeSignalHandlerTrait

Source
pub trait AcknowledgeSignalHandlerTrait {
    // Required methods
    fn send_true_to_signal_handler(&mut self) -> Result<(), AquaChannelError>;
    fn location(&self) -> String;

    // Provided method
    fn acknowledge_signal_handler(&mut self) { ... }
}
Expand description

A trait for objects that can send a shutdown acknowledgment to the SignalHandler.

This trait abstracts the boilerplate logic required for a thread to confirm that it has received a Quit command and is ready to terminate. By implementing this trait on a module’s channel struct, the module can simply call acknowledge_signal_handler() to handle the confirmation and logging automatically.

Required Methods§

Source

fn send_true_to_signal_handler(&mut self) -> Result<(), AquaChannelError>

Sends the raw acknowledgment message (true) to the SignalHandler.

This method must be implemented by any struct that uses the trait. It is responsible for the actual send-operation to the channel.

Source

fn location(&self) -> String

Returns the source location (module path) for logging purposes.

This method provides context for error logs, allowing developers to quickly identify which thread failed to send its acknowledgment.

Provided Methods§

Source

fn acknowledge_signal_handler(&mut self)

Acknowledges the SignalHandler by sending a confirmation message.

This is the primary method that threads should call during shutdown. It wraps the call to send_true_to_signal_handler with error handling, automatically logging a detailed error message if the sending to the channel fails.

Implementors§