exit                  package:fork                  R Documentation

_E_x_i_t _f_r_o_m _a _c_h_i_l_d _p_r_o_c_e_s_s

_D_e_s_c_r_i_p_t_i_o_n:

     Exit from a child process.

_U_s_a_g_e:

     exit(status = 0)

_A_r_g_u_m_e_n_t_s:

  status: Integer status flag. Use 0 for a normal exit.

_D_e_t_a_i_l_s:

     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'.

_V_a_l_u_e:

     None.

_N_o_t_e:

     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().

_A_u_t_h_o_r(_s):

     Gregory R. Warnes gregory_r_warnes\@groton.pfizer.com

_R_e_f_e_r_e_n_c_e_s:

     "_exit" man page

_S_e_e _A_l_s_o:

     'fork', 'getpid', 'wait', 'kill', 'killall'

_E_x_a_m_p_l_e_s:

     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()

