delay

Suspends execution of the calling thread for a specified interval.

Library:LibC
Service:General C Services

Syntax

  #include <unistd.h> 
   
  int delay (
     unsigned int   milliseconds); 
  

Parameters

milliseconds

(IN) Specifies the number of milliseconds the calling thread is to be delayed.

Return Values

If successful, returns 0. Otherwise, returns -1 and sets errno to one of the following:

Decimal

Constant

Description

5

ENOMEM

Not enough memory.

102

EINCONSIS

Internal library inconsistency (NetWare® 5.x and 6.x only).

105

ENOCONTEXT

The calling thread has no library context on which the delay operation can be scheduled (NetWare 4.x only).

Remarks

The delay function puts the calling thread to sleep for the number of milliseconds specified by the milliseconds parameter, rounded up to the next system clock tick.

NOTE:In practical application, the thread is delayed until it regains control of the processor, which might be considerably longer than the specified number of milliseconds.

To revoke delay, call cancel.

See Also

cancel