Microsoft DirectX 9.0 SDK Update (Summer 2003) |
IDirectPlay8ThreadPool::DoWork Method
Performs work that is currently scheduled.
Syntax
HRESULT DoWork(
const DWORD dwAllowedTimeSlice, const DWORD dwFlags );
Parameters
- dwAllowedTimeSlice
- [in] Specifies the time allowed for the work to complete. Set to INFINITE to allow all immediately available items to be run.
- dwFlags
- [in] Reserved. Must be 0.
Return Value
Returns DPN_OK if no additional work is immediately available. If dwAllowedTimeSlice is not set to INFINITE and the time specified has expired, leaving outstanding work items, DPNSUCCESS_PENDING will be returned. Otherwise, returns one of the following errors.
DPNERR_UNINITIALIZED The requested object has not been initialized. DPNERR_INVALIDFLAGS The flags passed to this method are invalid. DPNERR_NOTREADY The object is not ready for use. DPNERR_NOTALLOWED This function is not allowed on this object.
Remarks
This method allows Microsoft® DirectPlay® to operate without any threads of its own. It is expected that this method will be called at regular intervals so that time critical operations can be performed with reasonable accuracy.
The dwAllowedTimeSlice parameter must be between 0 and 60,000 milliseconds (1 minute) or it can be set to INFINITE. If it is set to 0, at most the first work item will be performed.
This method cannot be called unless the thread count has been set to 0. It will return DPNERR_NOTREADY if there are threads currently active.
If an attempt is made to call this method by more than one thread simultaneously, recursively, or within a DirectPlay callback, DPNERR_NOTALLOWED is returned.