Microsoft DirectX 9.0

IDirectPlay8ThreadPool::DoWork Method

Performs work that is currently scheduled.


HRESULT DoWork(      

    const DWORD dwAllowedTimeSlice,     const DWORD dwFlags );


[in] Specifies the time allowed for the work to complete. Set to INFINITE to allow all immediately available items to be run.
[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_UNINITIALIZEDThe requested object has not been initialized.
DPNERR_INVALIDFLAGSThe flags passed to this method are invalid.
DPNERR_NOTREADYThe object is not ready for use.
DPNERR_NOTALLOWEDThis function is not allowed on this object.


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.

© 2002 Microsoft Corporation. All rights reserved.