EventArray stores a list of events and allows the application to simultaneously wait for any of them to become set. More...
#include <EventArray.h>
Public Member Functions | |
| EventArray () | |
| Constructs an EventArray with an empty list of events. | |
| void | Clear () |
| Removes all the events added with AddEvent from this EventArray. | |
| void | AddEvent (const Event &e) |
| Adds the given event to the array. | |
| int | Wait (int msecs) |
| Waits for any of the added events to be triggered. | |
| int | Size () const |
| Returns the number of events added to the array. | |
Static Public Attributes | |
| static const int | WaitTimedOut = -1 |
| This status code is returned by Wait when none of the added events were triggered during the timeout period. | |
| static const int | WaitFailed = -2 |
| This status code is returned by Wait when the OS specified an error - the wait list most likely contains invalid entries. | |
EventArray stores a list of events and allows the application to simultaneously wait for any of them to become set.
This object never calls Create() or Close() on any Event that is added to it.
| void kNet::EventArray::AddEvent | ( | const Event & | e | ) |
Adds the given event to the array.
There is a limitation of maximum of 64 simultaneous Events that can be added to an array.
References kNet::EventWaitRead, kNet::EventWaitSignal, kNet::EventWaitWrite, kNet::Event::IsNull(), LOG, and kNet::Event::Type().
Referenced by kNet::Socket::IsOverlappedReceiveReady(), and kNet::Socket::IsOverlappedSendReady().
| int kNet::EventArray::Wait | ( | int | msecs | ) |
Waits for any of the added events to be triggered.
Returns the index of the signalled event, or EventArray::WaitTimedOut if none of the events triggered during the time period, or EventArray::WaitFailed if there were invalid event objects added in the array.
References kNet::EventWaitRead, kNet::EventWaitSignal, kNet::EventWaitWrite, LOG, WaitFailed, and WaitTimedOut.
Referenced by kNet::Socket::IsOverlappedReceiveReady(), and kNet::Socket::IsOverlappedSendReady().
1.7.1