| Line 1... |
Line 1... |
| 1 |
% File src/library/base/man/Sys.sleep.Rd
|
1 |
% File src/library/base/man/Sys.sleep.Rd
|
| 2 |
% Part of the R package, https://www.R-project.org
|
2 |
% Part of the R package, https://www.R-project.org
|
| 3 |
% Copyright 1995-2007 R Core Team
|
3 |
% Copyright 1995-2015 R Core Team
|
| 4 |
% Distributed under GPL 2 or later
|
4 |
% Distributed under GPL 2 or later
|
| 5 |
|
5 |
|
| 6 |
\name{Sys.sleep}
|
6 |
\name{Sys.sleep}
|
| 7 |
\alias{Sys.sleep}
|
7 |
\alias{Sys.sleep}
|
| 8 |
\title{Suspend Execution for a Time Interval}
|
8 |
\title{Suspend Execution for a Time Interval}
|
| 9 |
\description{
|
9 |
\description{
|
| 10 |
Suspend execution of \R expressions for a given number of seconds
|
10 |
Suspend execution of \R expressions for a specified time interval.
|
| 11 |
}
|
11 |
}
|
| 12 |
\usage{
|
12 |
\usage{
|
| 13 |
Sys.sleep(time)
|
13 |
Sys.sleep(time)
|
| 14 |
}
|
14 |
}
|
| 15 |
\arguments{
|
15 |
\arguments{
|
| 16 |
\item{time}{The time interval to suspend execution for, in seconds.}
|
16 |
\item{time}{The time interval to suspend execution for, in seconds.}
|
| 17 |
}
|
17 |
}
|
| 18 |
\details{
|
18 |
\details{
|
| 19 |
Using this function allows \R to be given very low priority and hence
|
19 |
Using this function allows \R to temporarily be given very low
|
| 20 |
not to interfere with more important foreground tasks. A typical use
|
20 |
priority and hence not to interfere with more important foreground
|
| 21 |
is to allow a process launched from \R to set itself up and read its
|
21 |
tasks. A typical use is to allow a process launched from \R to set
|
| 22 |
input files before \R execution is resumed.
|
22 |
itself up and read its input files before \R execution is resumed.
|
| 23 |
|
23 |
|
| 24 |
The intention is that this function suspends execution of \R
|
24 |
The intention is that this function suspends execution of \R
|
| 25 |
expressions but wakes the process up often enough to respond to GUI
|
25 |
expressions but wakes the process up often enough to respond to GUI
|
| 26 |
events, typically every 0.5 seconds.
|
26 |
events, typically every half second. It can be interrupted
|
| - |
|
27 |
(e.g.\sspace{}by \samp{Ctrl-C} or \samp{Esc} at the \R console).
|
| 27 |
|
28 |
|
| 28 |
There is no guarantee that the process will sleep for the whole of the
|
29 |
There is no guarantee that the process will sleep for the whole of the
|
| 29 |
specified interval, and it may well take slightly longer in real time
|
30 |
specified interval (sleep might be interrupted), and it may well take
|
| - |
|
31 |
slightly longer in real time to resume execution.
|
| - |
|
32 |
|
| - |
|
33 |
\code{time} must be non-negative (and not \code{NA} nor \code{NaN}):
|
| - |
|
34 |
\code{Inf} is allowed (and might be appropriate if the intention is to
|
| 30 |
to resume execution. The resolution of the time interval is
|
35 |
wait indefinitely for an interrupt). The resolution of the time
|
| 31 |
system-dependent, but will normally be down to 0.02 secs or better.
|
36 |
interval is system-dependent, but will normally be 20ms or better.
|
| 32 |
(On modern Unix-alikes it will be better than 1ms.)
|
37 |
(On modern Unix-alikes it will be better than 1ms.)
|
| 33 |
}
|
38 |
}
|
| 34 |
\value{
|
39 |
\value{
|
| 35 |
Invisible \code{NULL}.
|
40 |
Invisible \code{NULL}.
|
| 36 |
}
|
41 |
}
|
| 37 |
\note{
|
42 |
\note{
|
| 38 |
This function may not be implemented on all systems. Where it is not
|
43 |
Despite its name, this is not currently implemented using the
|
| 39 |
implemented calling it given an error.
|
44 |
\code{sleep} system call (although on Windows it does make use of
|
| - |
|
45 |
\code{Sleep}).
|
| 40 |
}
|
46 |
}
|
| 41 |
|
47 |
|
| 42 |
\examples{\donttest{
|
48 |
\examples{\donttest{
|
| 43 |
testit <- function(x)
|
49 |
testit <- function(x)
|
| 44 |
{
|
50 |
{
|