sleep, usleep

sleep, usleep — suspend execution.

Synopsis

sleep (seconds)
usleep (microseconds)

		

Arguments

seconds

The integer number of seconds to sleep.

microseconds

The integer number of microseconds to sleep.

Returns

t

Description

These functions suspend execution for the given number of seconds or microseconds, after which time the task continues. Signals and timers will still be processed during this time.

[Note]

This function is ignored in Windows, as it would cause all scripts to hang, but is maintained for compatibility. Instead, you can use a .TimerAfter timer, like this:

.TimerAfter (3, `some_code);

For example, to call the "myMethod" method with no arguments:

.TimerAfter(3, `(@self).myMethod());

Or, for example, to print "end":

.TimerAfter(3, `princ("end\n"));

Example

Gamma> sleep (3);

(after 3 seconds...)

t
Gamma> usleep (500000);

(after 1/2 second...)

t
Gamma> 
		

See Also

nanosleep