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. |
typedef ULONG_PTR ThreadIdentifier |
typedef unsigned short ThreadCount |
Reimplemented in CIOPoolBase.
typedef void* DeviceHandle [inherited] |
~IIOPool | ( | ) | [override, protected] |
We never delete instances of this interface; you must manage the lifetime of the class that implements it.
virtual ThreadCount GetNumberOfThreads | ( | ) | 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.
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] |
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] |
Implements IAssociateDeviceWithIOSubSystem.
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] |
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] |
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] |
Implemented in CIOPoolBase.