E-MailRelay
Public Member Functions | Protected Member Functions | List of all members
GNet::ExceptionHandler Class Referenceabstract

An abstract interface for handling exceptions thrown out of event-loop callbacks (socket events, future events and timer events). More...

#include <gexceptionhandler.h>

+ Inheritance diagram for GNet::ExceptionHandler:

Public Member Functions

virtual void onException (std::exception &)=0
 Called by the event loop when an exception is thrown out of an event loop callback. More...
 

Protected Member Functions

virtual ~ExceptionHandler ()
 Destructor.
 

Detailed Description

An abstract interface for handling exceptions thrown out of event-loop callbacks (socket events, future events and timer events).

If the handler just rethrows then the event loop will terminate.

Many GNet classes require a ExceptionHandler reference to be passed around, but only classes that manage their own lifetimes on the heap will use this as a base; these classes override onException() to absorb the exception and schedule their own deletion.

The event loop itself derives from this interface as a convenience.

Definition at line 44 of file gexceptionhandler.h.

Member Function Documentation

virtual void GNet::ExceptionHandler::onException ( std::exception &  )
pure virtual

Called by the event loop when an exception is thrown out of an event loop callback.

The implementation may just do a "throw" to rethrow the current exception out of the event loop, or schedule a "delete this" for objects that manage themselves on the heap.

Implemented in GNet::ServerPeer, GNet::EventLoop, and GNet::HeapClient.


The documentation for this class was generated from the following files: