delay()

Delays the next program step.

Synopsis

int delay( unsigned sec [, unsigned milli] );

Parameters

Parameter Meaning
sek Duration in seconds. If 0 is specified, the thread will be interrupted.
milli Duration in milliseconds (optional)

Return Value

In the event of errors -1, otherwise 0.

Errors

Missing arguments

Description

The delay() function can be used to delay the next program step by a given number of seconds.

If 0 is specified, the thread will be interrupted. This can be meaningful for test purposes and other scenarios, for example to go to dispatch an to send pending messages. It should be noted that if the duration is calculated and 0 is accepted, then the script will be interrupted at this point.

The specification of milliseconds is optional. The default value is zero.

Example

main()
{
  delay(5); // waits 5 seconds
}

Assignment

Miscellaneous functions, waiting Control functions

Availability

CTRL