ast_comparator/test/student_data/handout/shlab-handout/cases/prev_13_tsh.c
/*
 * waitfg - Block until process pid is no longer the foreground process
 */
Block until process pid is no longer the foreground process
Block until process pid is no longer the foreground process
void waitfg(pid_t pid)
{
	struct job_t *job = getjobpid(jobs, pid); 
	if(job == NULL) return;
  while((job->state == FG) && (pid == job->pid)){ 
		sleep(1);
	}
}
void waitfg ( pid_t pid ) { struct job_t * job = getjobpid ( jobs , pid ) ; if ( job == NULL ) return ; while ( ( job -> state == FG ) && ( pid == job -> pid ) ) { sleep ( 1 ) ; } }
waitfg - Block until process pid is no longer the foreground process
waitfg - Block until process pid is no longer the foreground process
/* Actually, waitfg is called only if pid is for foreground job. 
																							 However, this function doesn't know whether or not it is foreground job.
																							 Instead, filltering is in below( ... == FG). */ /* wait that forground jobs. 
																										 sleep(1) gives sufficient term to make these method stable. */