Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

OW32::CIOCPIoTimeoutManager Class Reference

An I/O timeout manager. More...

#include <IOCPIoTimeoutManager.h>

Inheritance diagram for OW32::CIOCPIoTimeoutManager:

OW32::CIoTimeoutManager List of all members.

Public Member Functions

 CIOCPIoTimeoutManager ()
 Default c'tor.
 ~CIOCPIoTimeoutManager ()
 D'tor cleaning up.
virtual bool addTimeout (CIoTimeoutCallback *pCallback, LPVOID key, __int64 after, bool *fUpdated=NULL)
 Add a timeout.
virtual bool updateTimeout (CIoTimeoutCallback *pCallback, LPVOID key, __int64 after, bool *fUpdated=NULL)
 Update a previously added timeout.
virtual bool removeTimeout (LPVOID key)
 Remove a previously added timeout.
virtual void drainTimeouts (CIoTimeoutDrainCallback *pCallback)
 Drain timeouts, potentially using a predicate function.
bool addTimeout (CAsyncIoCompletionSocket *pSocket)
 Add a timeout for the given IOCP socket.
bool updateTimeout (CAsyncIoCompletionSocket *pSocket)
 Update a previously added timeout for the given socket.
void removeTimeout (CAsyncIoCompletionSocket *pSocket)
 Remove a previously added timeout for the given socket.
virtual bool shutdown ()
 Shutdown the timeout manager.
bool initialise (HANDLE hCompletionPort)
 Initialise the timeout manager.

Detailed Description

An I/O timeout manager.


Member Function Documentation

bool OW32::CIOCPIoTimeoutManager::addTimeout CAsyncIoCompletionSocket pSocket  ) 
 

Add a timeout for the given IOCP socket.

Parameters:
pSocket The socket to add a timeout for

virtual bool OW32::CIOCPIoTimeoutManager::addTimeout CIoTimeoutCallback pCallback,
LPVOID  key,
__int64  after,
bool *  fUpdated = NULL
[virtual]
 

Add a timeout.

The timeout object must implement #CIoTimeoutCallback, and the onTimeout function will be called after the specified time.

If the key exists, the timeout for the existing object will be updated to expire after the given interval.

Parameters:
pCallback The callback function
key Key for passing to the callback function and for use during removeTimeout.
after The timeout, in 100ns units.
fUpdated Output - true if the timeout was updated, false otherwise.
Returns:
true if successful, false if not. GetLastError returns the error code in the failure case.

Implements OW32::CIoTimeoutManager.

virtual void OW32::CIOCPIoTimeoutManager::drainTimeouts CIoTimeoutDrainCallback pCallback  )  [virtual]
 

Drain timeouts, potentially using a predicate function.

This function can be used to clear the timeout queue before shutdown if necessary. It is also possible to conditionally drain timeouts. Timeouts are removed if the predicate function returns true.

Parameters:
pCallback An object implementing the predicate function interface

Implements OW32::CIoTimeoutManager.

bool OW32::CIOCPIoTimeoutManager::initialise HANDLE  hCompletionPort  ) 
 

Initialise the timeout manager.

Parameters:
hCompletionPort The IOCP to use
Returns:
true for success, false for failure (see GetLastError)

void OW32::CIOCPIoTimeoutManager::removeTimeout CAsyncIoCompletionSocket pSocket  ) 
 

Remove a previously added timeout for the given socket.

Parameters:
pSocket The socket to remove a timeout for

virtual bool OW32::CIOCPIoTimeoutManager::removeTimeout LPVOID  key  )  [virtual]
 

Remove a previously added timeout.

Parameters:
key The key passed to addTimeout()
Returns:
true if the timeout was removed, false if it could not be found (already triggered or removed)

Implements OW32::CIoTimeoutManager.

virtual bool OW32::CIOCPIoTimeoutManager::shutdown  )  [virtual]
 

Shutdown the timeout manager.

Returns:
true for success, false for failure (see GetLastError)

Implements OW32::CIoTimeoutManager.

bool OW32::CIOCPIoTimeoutManager::updateTimeout CAsyncIoCompletionSocket pSocket  ) 
 

Update a previously added timeout for the given socket.

Parameters:
pSocket The socket to update the timeout for

virtual bool OW32::CIOCPIoTimeoutManager::updateTimeout CIoTimeoutCallback pCallback,
LPVOID  key,
__int64  after,
bool *  fUpdated = NULL
[virtual]
 

Update a previously added timeout.

Parameters:
pCallback The new callback function
key The existing key
after The new time to expire after
fUpdated Optional output - true if the timeout was updated, false otherwise.
Returns:
true if successful, false if not. GetLastError returns the error code in the failure case.

Implements OW32::CIoTimeoutManager.


The documentation for this class was generated from the following file:
Generated on Sun Jun 5 01:29:25 2005 for OW32 by  doxygen 1.3.9.1