[ Home | Alpha index | Topic index | Tutorials | Download | Feedback ]

The OS/2 API Project

DosSleep

[ Syntax | Params | Returns | Include | Usage | Structs | Gotchas | Code | Also ]

Syntax

rc = DosSleep( ulInterval );

Parameters

ULONG ulInterval (input)
The time that the calling thread will sleep. In milliseconds.

Returns

APIRET  rc
0       NO_ERROR
322     ERROR_TS_WAKEUP

Include Info

#define INCL_DOSDATETIME
#include <os2.h>

Usage Explanation

DosSleep causes the calling thread to be suspended for a given time.

Relevant Structures

Gotchas

Calling DosSleep with 0 as the argument will give up the rest of the threads current time-slice. The time to sleep will be rounded up by the system to the next clock tick. Note that this does not seem to work on many systems, so DosSleep(1) is safer.

Sample Code

#define INCL_DOSDATETIME #include <os2.h> APIRET rc; rc=DosSleep(2000); /* Suspend the thread for 2 seconds */

See Also

Author

Oscar Gustafsson - oscar@lysator.liu.se

Additions

Carsten Whimster - timur@vnet.ibm.com

Last modified September 21/1996
Please send all errors, comments, and suggestions to: timur@vnet.ibm.com

The OS/2 API Project

DosSleep