exit {fork} | R Documentation |
Exit from a child process.
exit(status = 0)
status |
Integer status flag. Use 0 for a normal exit. |
This function is a shallow warpper adound the Unix "_exit" command,
and should be used instead of quit()
to exit from a process
created via fork
.
None.
The fork
command automatically sets up an on.exit
function that calls exit
before evaluating the slave
argument, so it is usually not necessary to directly call exit().
Gregory R. Warnes greg@random-technologies-llc.com
"_exit" man page
fork
, getpid
, wait
,
kill
, killall
waittest <- function() { pid = fork(NULL) if(pid==0) { cat("Hi, I'm the child process and I need to explicitly call exit().") cat("\n\n") exit() } else { wait(pid) cat("Hi, I'm the main process, and I wait()ed until the child process\n") cat("finished before introducing myself.\n") } } waittest()