ast_comparator/test/student_data/handout/shlab-handout/cases/reference_5_tsh.c
/* wait_fgjob - Wait for the foreground job to finish */
Wait for the foreground job to finish
Wait for the foreground job to finish
void 
wait_fgjob(struct job_t* job_ptr)
{
    sigset_t empset;
    if (sigemptyset(&empset) != 0) {
        unix_error("Error in sigemptyset");
    }
    while (fgpid(job_list) != 0 && job_ptr->state == FG) {
        sigsuspend(&empset);
    }
}
void wait_fgjob ( struct job_t * job_ptr ) { sigset_t empset ; if ( sigemptyset ( & empset ) != 0 ) { unix_error ( " " ) ; } while ( fgpid ( job_list ) != 0 && job_ptr -> state == FG ) { sigsuspend ( & empset ) ; } }
wait_fgjob - Wait for the foreground job to finish
wait_fgjob - Wait for the foreground job to finish
/* Create an empty set */ /* Wait for the foreground job using sigsuspend for performance */