waitpid: Wait for a pid to finish

Description Usage Arguments See Also Examples

View source: R/bfork.R

Description

Halts execution until the process identified by the pid given as
an argument terminates.

Usage

1
    waitpid(child_pid)

Arguments

child_pid

the pid of the child process to wait for

See Also

fork.
wait.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
    ## create a function to be run as a separate process
    fn <- function() {
        Sys.sleep(4)
        print("World!")
    }

    ## fork the process
    pid <- fork(fn)

    ## do work in the parent process
    print("Hello")

    ## wait for the child process
    waitpid(pid)

bfork documentation built on May 29, 2017, 10:01 p.m.