RTEMS Logo

RTEMS 4.10.0 On-Line Library


General Commands sleep - delay for a specified amount of time

PREV UP NEXT Bookshelf RTEMS Shell User's Guide

2.2.4: sleep - delay for a specified amount of time

SYNOPSYS:

sleep seconds
sleep seconds nanoseconds

DESCRIPTION:

This command causes the task executing the shell to block for the specified number of seconds and nanoseconds.

EXIT STATUS:

This command returns 0 on success and non-zero if an error is encountered.

NOTES:

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.

EXAMPLES:

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.

CONFIGURATION:

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.

PROGRAMMING INFORMATION:

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;


PREV UP NEXT Bookshelf RTEMS Shell User's Guide

Copyright © 1988-2008 OAR Corporation