ast_comparator/test/student_data/handout/shlab-handout/cases/reference_6_tsh.c
/* 
 * waitfg - Block until process pid is no longer the foreground process
 * If pid is no longer in the job list, just return.
 * Otherwise, wait while the state of pid is FG. 
 * Wait 1 sec and check the state again. Keep waiting for 1 sec and 
 * checking the state until the state is not FG. 
 */
Block until process pid is no longer the foreground process
If pid is no longer in the job list, just return.
Otherwise, wait while the state of pid is FG.
Wait 1 sec and check the state again. Keep waiting for 1 sec and
checking the state until the state is not FG.
Block until process pid is no longer the foreground process If pid is no longer in the job list just return . Otherwise wait while the state of pid is FG . Wait 1 sec and check the state again . Keep waiting for 1 sec and checking the state until the state is not FG .
void waitfg(pid_t pid)
{
    struct job_t *p = getjobpid(jobs, pid);
    while (p->state == FG)
    sleep(1);
    return;
}
void waitfg ( pid_t pid ) { struct job_t * p = getjobpid ( jobs , pid ) ; while ( p -> state == FG ) sleep ( 1 ) ; return ; }
waitfg - Block until process pid is no longer the foreground process
 If pid is no longer in the job list, just return.
waitfg - Block until process pid is no longer the foreground process If pid is no longer in the job list just return .