ast_comparator/test/student_data/handout/shlab-handout/cases/50_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;
	while(1)
	{
		job = getjobpid(jobs, pid);
		if(job == NULL || job->state == ST)
			break;
		sleep(1);
	}
	return;
}
void waitfg ( pid_t pid ) { struct job_t * job ; while ( 1 ) { job = getjobpid ( jobs , pid ) ; if ( job == NULL || job -> state == ST ) break ; sleep ( 1 ) ; } return ; }
waitfg - Block until process pid is no longer the foreground process
waitfg - Block until process pid is no longer the foreground process
// Check whether the process stopped or terminated