EVOLUTION-MANAGER
Edit File: Sys.sleep.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Suspend Execution for a Time Interval</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for Sys.sleep {base}"><tr><td>Sys.sleep {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Suspend Execution for a Time Interval</h2> <h3>Description</h3> <p>Suspend execution of <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> expressions for a specified time interval. </p> <h3>Usage</h3> <pre> Sys.sleep(time) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>time</code></td> <td> <p>The time interval to suspend execution for, in seconds.</p> </td></tr> </table> <h3>Details</h3> <p>Using this function allows <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> to temporarily be given very low priority and hence not to interfere with more important foreground tasks. A typical use is to allow a process launched from <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> to set itself up and read its input files before <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> execution is resumed. </p> <p>The intention is that this function suspends execution of <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> expressions but wakes the process up often enough to respond to GUI events, typically every half second. It can be interrupted (e.g. by <span class="samp">Ctrl-C</span> or <span class="samp">Esc</span> at the <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> console). </p> <p>There is no guarantee that the process will sleep for the whole of the specified interval (sleep might be interrupted), and it may well take slightly longer in real time to resume execution. </p> <p><code>time</code> must be non-negative (and not <code>NA</code> nor <code>NaN</code>): <code>Inf</code> is allowed (and might be appropriate if the intention is to wait indefinitely for an interrupt). The resolution of the time interval is system-dependent, but will normally be 20ms or better. (On modern Unix-alikes it will be better than 1ms.) </p> <h3>Value</h3> <p>Invisible <code>NULL</code>. </p> <h3>Note</h3> <p>Despite its name, this is not currently implemented using the <code>sleep</code> system call (although on Windows it does make use of <code>Sleep</code>). </p> <h3>Examples</h3> <pre> testit <- function(x) { p1 <- proc.time() Sys.sleep(x) proc.time() - p1 # The cpu usage should be negligible } testit(3.7) </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>