contents   index   previous   next



Unix.wait()

syntax:

Unix.wait(status)

where:

status - status of the process.

 

return:

number - process id of the exiting child, else -1 for error.

 

description:

A call to Unix.wait() will suspend execution until a child process terminates, then return the id of the particular child that exited. The status parameter is filled in with the status code for the process (this is the raw data exactly as returned by the underlying C wait() call provided for Unix gurus who find this information useful.) Any resources used by the Child are cleaned up.

 

see:

Unix.kill(), Unix.waitpid()

 

example:

// Here is a simple example:

 

function main()

{

   var id = Unix.fork();

 

   if( id==0 )

   {

      Clib.printf("Child here!\n");

      Clib.exit(0);

   }

   else

   {

      Clib.printf("started child process %d\n", id);

      Clib.assert( Unix.wait(var dontcare)==id );

      Clib.printf("child process is dead meat.\n");

   }

}

 


Unix.waitpid()