previous | start | next

The waitfg Function

The lab document suggests that this function wait by "busy waiting around sleep."

The function comment in the tsh.c file provided says

/*
 * waitfg - Block until process pid is no longer the foreground process
 */
     

You can do this by writing a loop that checks the state of the foreground process (if there is one!)

For this to work, you will need to have updated the state of jobs correctly in other functions when the state changes.



previous | start | next