VideoTools
|
A class that maps from a file descriptor to an event handler, used in the implemention of classes derived from GNet::EventLoop. More...
#include <geventhandler.h>
Classes | |
struct | Iterator |
An iterator for file-descriptor/handler-function pairs in a GNet::EventHandlerList. More... | |
Public Member Functions | |
EventHandlerList (const std::string &type) | |
Constructor. More... | |
void | add (Descriptor fd, EventHandler *handler) |
Adds a file-descriptor/handler pair to the list. | |
void | remove (Descriptor fd) |
Removes a file-descriptor from the list. | |
bool | contains (Descriptor fd) const |
Returns true if the list contains the given file-descriptor. | |
EventHandler * | find (Descriptor fd) |
Finds the handler associated with the given file descriptor. | |
void | lock () |
To be called at the start of an begin()/end() iteration if the list might change during the iteration. More... | |
void | unlock () |
Called at the end of a begin()/end() iteration to match a call to lock(). More... | |
void | collectGarbage () |
Collects garbage resulting from remove()s. More... | |
Iterator | begin () const |
Returns a forward iterator. | |
Iterator | end () const |
Returns an end iterator. | |
A class that maps from a file descriptor to an event handler, used in the implemention of classes derived from GNet::EventLoop.
Definition at line 105 of file geventhandler.h.
|
explicit |
Constructor.
The type parameter (eg. "read") is used only in debugging messages.
Definition at line 64 of file geventhandler.cpp.
void GNet::EventHandlerList::collectGarbage | ( | ) |
Collects garbage resulting from remove()s.
Automatically called from unlock().
Definition at line 175 of file geventhandler.cpp.
void GNet::EventHandlerList::lock | ( | ) |
To be called at the start of an begin()/end() iteration if the list might change during the iteration.
Must be paired with unlock().
Definition at line 147 of file geventhandler.cpp.
void GNet::EventHandlerList::unlock | ( | ) |
Called at the end of a begin()/end() iteration to match a call to lock().
Does garbage collection.
Definition at line 152 of file geventhandler.cpp.