sleep seconds sleep seconds nanoseconds
This command causes the task executing the shell to block
for the specified number of seconds
and nanoseconds
.
This command returns 0 on success and non-zero if an error is encountered.
This command is implemented using the nanosleep()
method.
The command line interface is similar to the sleep
command
found on POSIX systems but the addition of the nanoseconds
parameter allows fine grained delays in shell scripts without
adding another command such as usleep
.
The following is an example of how to use sleep
:
SHLL [/] $ sleep 10 SHLL [/] $ sleep 0 5000000
It is not clear from the above but there is a ten second pause after executing the first command before the prompt is printed. The second command completes very quickly from a human perspective and there is no noticeable delay in the prompt being printed.
This command is included in the default shell command set.
When building a custom command set, define
CONFIGURE_SHELL_COMMAND_SLEEP
to have this
command included.
This command can be excluded from the shell command set by
defining CONFIGURE_SHELL_NO_COMMAND_SLEEP
when all
shell commands have been configured.
The sleep
is implemented by a C language function
which has the following prototype:
int rtems_shell_rtems_main_sleep( int argc, char **argv );
The configuration structure for the sleep
has the
following prototype:
extern rtems_shell_cmd_t rtems_shell_SLEEP_Command;
Copyright © 1988-2008 OAR Corporation