Learn R Programming

bfork (version 0.1.2)

waitpid: Wait for a pid to finish

Description

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

Usage

waitpid(child_pid)

Arguments

child_pid
the pid of the child process to wait for

See Also

fork. wait.

Examples

Run this code
    ## 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)

Run the code above in your browser using DataLab