Module graceful

Module graceful 

Source
Expand description

Graceful shutdown mechanism for IPC channels

This module provides the GracefulChannel trait for implementing graceful shutdown in IPC channels, preventing errors like EventLoopClosed when background threads continue sending messages after the main event loop has closed.

§Example

use ipckit::{NamedPipe, GracefulChannel, GracefulNamedPipe};
use std::time::Duration;

fn main() -> Result<(), ipckit::IpcError> {
    let pipe = NamedPipe::create("my_pipe")?;
    let graceful = GracefulNamedPipe::new(pipe);

    // ... use the channel ...

    // Graceful shutdown
    graceful.shutdown();
    graceful.drain()?; // Wait for pending messages

    Ok(())
}

Structs§

GracefulIpcChannel
IPC channel with graceful shutdown support
GracefulNamedPipe
Named pipe with graceful shutdown support
GracefulWrapper
A wrapper that adds graceful shutdown capability to any channel
OperationGuard
RAII guard for tracking pending operations
ShutdownState
Shutdown state that can be shared between channel instances

Traits§

GracefulChannel
Trait for channels that support graceful shutdown