40 lines
1.3 KiB
C
40 lines
1.3 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* do_job_notification.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2016/12/15 13:01:19 by jhalford #+# #+# */
|
|
/* Updated: 2017/03/18 00:07:12 by wescande ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "minishell.h"
|
|
|
|
int do_job_notification(void)
|
|
{
|
|
t_job *j;
|
|
t_list *jlist;
|
|
t_jobc *jobc;
|
|
int ret;
|
|
|
|
ret = 0;
|
|
job_update_status();
|
|
jobc = &data_singleton()->jobc;
|
|
jlist = jobc->first_job;
|
|
while (jlist)
|
|
{
|
|
j = jlist->content;
|
|
jlist = jlist->next;
|
|
if (job_is_completed(j->id)
|
|
|| (job_is_stopped(j->id) && !(j->attrs & JOB_NOTIFIED)))
|
|
{
|
|
ret = 1;
|
|
job_notify_change(j->id);
|
|
j->attrs |= JOB_NOTIFIED;
|
|
job_remove(j->id);
|
|
}
|
|
}
|
|
return (ret);
|
|
}
|