2 * (c) Oleg Puchinin 2006
3 * graycardinalster@gmail.com
22 /// Добавить процесс (на контроль).
23 __djob_t
* DJobs::add (int pid
, char * user_data
)
28 j
->user_data
= user_data
;
33 __djob_t
* DJobs::attach (__djob_t
* j
)
38 return (__djob_t
*) add_tail (LPCHAR(j
));
41 __djob_t
* DJobs::zombie ()
49 pid
= waitpid (-1, &status
, WNOHANG
);
53 return __do_zombie (pid
, status
);
56 __djob_t
* DJobs::__do_zombie (pid_t pid
, int exit_status
)
58 __djob_t
* j
= by_pid (pid
);
61 j
->exit_status
= exit_status
;
66 __djob_t
* DJobs::wait_all ()
73 pid
= waitpid (-1, &status
, 0);
76 j
= __do_zombie (pid
, status
);
83 __djob_t
* DJobs::alloc_job ()
86 j
= CNEW (__djob_t
, 1);
91 __djob_t
* DJobs::by_pid (pid_t pid
)
95 while ((j
= (__djob_t
*) get ()) && j
) {
103 __djob_t
* DJobs::fork ()