qb  2.0.0.0
C++17 Actor Framework
qb Issue Watch Star Fork Follow @isndev
Loading...
Searching...
No Matches
qb::io::async::event::dispose Struct Reference

Event triggered just before an asynchronous I/O object is destroyed or cleaned up. More...

#include <dispose.h>

Detailed Description

Event triggered just before an asynchronous I/O object is destroyed or cleaned up.

This event is passed to the derived class's on(qb::io::async::event::dispose&&) method as a final opportunity to perform cleanup operations before the I/O object and its associated resources (like event watchers) are released. This is typically part of the dispose() method in base classes like qb::io::async::io.

Usage Example:

class MyResourcefulIO : public qb::io::async::io<MyResourcefulIO> {
public:
// ... constructor, other methods ...
void on(qb::io::async::event::dispose &&) {
LOG_INFO("MyResourcefulIO disposing: cleaning up custom resources.");
// Perform final cleanup operations specific to MyResourcefulIO
// Note: Base class dispose() will handle listener unregistration.
}
void someErrorCondition() {
// ... error detected ...
this->disconnect(); // This will eventually lead to dispose() being called internally.
}
};
CRTP base class for managing bidirectional asynchronous I/O operations with protocol processing.
Definition io.h:938
void disconnect(int reason=1)
Initiates a graceful disconnection.
Definition io.h:1098
#define LOG_INFO(X)
Info-level log macro (no-op if QB_STDOUT_LOG is not defined)
Definition io.h:229