The C++ framework for developing highly scalable, high performance servers on Windows platforms.

IIOPool Class Reference
[InterfacesWin32 Threading primitivesI/O BuffersAsynchronous I/OProtected destructors on abstract base classes]

Inheritance diagram for IIOPool:
Collaboration diagram for IIOPool:

List of all members.


Detailed Description

An interface to an I/O thread pool (usually based on an I/O completion port) that can have operations on buffers and handlers dispatched to it (either directly or as a result of an I/O completion packet being generated by some asynchronous I/O event) and that handles these events on one of the threads in the pool.

Public Types

typedef ULONG_PTR ThreadIdentifier
typedef unsigned short ThreadCount
typedef void * DeviceHandle

Public Member Functions

virtual void Dispatch (IHandler &handler, IBuffer *pBuffer, DWORD numberOfBytes)=0
 Dispatch a buffer and a handler to the pool.
virtual ThreadCount GetNumberOfThreads () const =0
 Returns the number of threads in the pool.
virtual void AssociateDevice (HANDLE hDevice, IHandler &handler) const =0
 Associate a HANDLE with a handler. I/O completion packets that the HANDLE generates will be handled by the handler.
virtual bool TryAssociateDevice (HANDLE hDevice, IHandler &handler) const =0
 Attempt to associate a HANDLE with a handler. I/O completion packets that the HANDLE generates will be handled by the handler. Returns false, rather than throwing an exception, if an error occurs, you can call GetLastError() to retrieve the error message;.
void ScheduleOperation (IRefCountedHandler &handler) override=0
DWORD AssociateDeviceWithIOSubSystem (DeviceHandle device, IHandler &handler, const DWORD) override
DWORD ModifyDeviceAssociation (DeviceHandle, IHandler &, DWORD) override
DWORD DisassociateDeviceFromIOSubSystem (DeviceHandle, DWORD) override
bool IsIOThread () const override
virtual bool ThreadIsInPool () const =0
 Returns true if the calling thread is a member of the thread I/O thread pool. The I/O pool uses a TLS slot to store a, non-zero, identifier for all the threads that make up the pool. Some I/O operations can be performed more efficiently if done on a thread that is known to be part of the I/O pool.
virtual void JoinLogicalThreadGroup () const =0
 Allows an arbitrary thread to join the thread pool's logical group. This can be used by threads that will 'never exit' during the program lifetime to be treated as I/O threads for the purposes of not needing to marshal I/O requests to the I/O pool before issuing them. Use with care, on pre-Vista boxes I/O is cancelled if the issuing thread exits before it completes.
virtual HANDLE GetHandle () const =0
 Obtains the handle to the underlying IOCP, use with care!!! We only need to expose this because the SetInformationJobObject function needs it... This is a really NASTY hack as the pool need not be based on a physical IOCP, if it isn't then this method will return INVALID_HANDLE_VALUE.
virtual void Start ()=0
 Start the threads in the thread pool.
virtual void BeginShutdown ()=0
 Request that the threads shut themselves down once they complete working on the current work items in the queue.
virtual void WaitForShutdownToComplete ()=0
 Wait for all the threads to finish.
virtual DWORD AssociateDeviceWithIOSubSystem (DeviceHandle device, IHandler &handler, DWORD flags)=0
virtual DWORD ModifyDeviceAssociation (DeviceHandle device, IHandler &handler, DWORD flags)=0
virtual DWORD DisassociateDeviceFromIOSubSystem (DeviceHandle device, DWORD flags)=0
virtual void Dispatch (IHandler &handler, DWORD userData)=0

Protected Member Functions

 ~IIOPool () override
 We never delete instances of this interface; you must manage the lifetime of the class that implements it.

Member Typedef Documentation

typedef unsigned short ThreadCount

Reimplemented in CIOPoolBase.

typedef void* DeviceHandle [inherited]


Constructor & Destructor Documentation

~IIOPool (  )  [override, protected]

We never delete instances of this interface; you must manage the lifetime of the class that implements it.


Member Function Documentation

virtual void Dispatch ( IHandler handler,
IBuffer *  pBuffer,
DWORD  numberOfBytes 
) [pure virtual]

Dispatch a buffer and a handler to the pool.

Implemented in CIOPoolBase.

virtual ThreadCount GetNumberOfThreads (  )  const [pure virtual]

Returns the number of threads in the pool.

Implemented in CIOPoolBase.

virtual void AssociateDevice ( HANDLE  hDevice,
IHandler handler 
) const [pure virtual]

Associate a HANDLE with a handler. I/O completion packets that the HANDLE generates will be handled by the handler.

Implemented in CIOPoolBase.

virtual bool TryAssociateDevice ( HANDLE  hDevice,
IHandler handler 
) const [pure virtual]

Attempt to associate a HANDLE with a handler. I/O completion packets that the HANDLE generates will be handled by the handler. Returns false, rather than throwing an exception, if an error occurs, you can call GetLastError() to retrieve the error message;.

Implemented in CIOPoolBase.

void ScheduleOperation ( IRefCountedHandler handler  )  [override, pure virtual]

Implements IAssociateDeviceWithIOSubSystem.

Implemented in CIOPoolBase.

DWORD AssociateDeviceWithIOSubSystem ( DeviceHandle  device,
IHandler handler,
const   DWORD 
) [inline, override]

DWORD ModifyDeviceAssociation ( DeviceHandle  ,
IHandler ,
DWORD   
) [inline, override]

DWORD DisassociateDeviceFromIOSubSystem ( DeviceHandle  ,
DWORD   
) [inline, override]

bool IsIOThread (  )  const [inline, override, virtual]

virtual bool ThreadIsInPool (  )  const [pure virtual]

Returns true if the calling thread is a member of the thread I/O thread pool. The I/O pool uses a TLS slot to store a, non-zero, identifier for all the threads that make up the pool. Some I/O operations can be performed more efficiently if done on a thread that is known to be part of the I/O pool.

Implemented in CIOPoolBase.

virtual void JoinLogicalThreadGroup (  )  const [pure virtual]

Allows an arbitrary thread to join the thread pool's logical group. This can be used by threads that will 'never exit' during the program lifetime to be treated as I/O threads for the purposes of not needing to marshal I/O requests to the I/O pool before issuing them. Use with care, on pre-Vista boxes I/O is cancelled if the issuing thread exits before it completes.

Implemented in CIOPoolBase.

virtual HANDLE GetHandle (  )  const [pure virtual]

Obtains the handle to the underlying IOCP, use with care!!! We only need to expose this because the SetInformationJobObject function needs it... This is a really NASTY hack as the pool need not be based on a physical IOCP, if it isn't then this method will return INVALID_HANDLE_VALUE.

Implemented in CIOPoolBase.

virtual void Start (  )  [pure virtual, inherited]

Start the threads in the thread pool.

Implemented in CIOPoolBase.

virtual void BeginShutdown (  )  [pure virtual, inherited]

Request that the threads shut themselves down once they complete working on the current work items in the queue.

Implemented in CIOPoolBase.

virtual void WaitForShutdownToComplete (  )  [pure virtual, inherited]

Wait for all the threads to finish.

Implemented in CIOPoolBase.

virtual DWORD AssociateDeviceWithIOSubSystem ( DeviceHandle  device,
IHandler handler,
DWORD  flags 
) [pure virtual, inherited]

virtual DWORD ModifyDeviceAssociation ( DeviceHandle  device,
IHandler handler,
DWORD  flags 
) [pure virtual, inherited]

virtual DWORD DisassociateDeviceFromIOSubSystem ( DeviceHandle  device,
DWORD  flags 
) [pure virtual, inherited]

virtual void Dispatch ( IHandler handler,
DWORD  userData 
) [pure virtual, inherited]

Implemented in CIOPoolBase.


Generated on Sun Sep 12 19:09:29 2021 for The Server Framework - v7.4 by doxygen 1.5.3