blob: 05d7f37f34c163ae28104d03c9cf0060d36a5b87 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
/* ISC license. */
#include <sys/wait.h>
#include <skalibs/djbunix.h>
int waitn (pid_t *pids, unsigned int n)
{
while (n)
{
int wstat ;
unsigned int i = 0 ;
pid_t pid = wait_nointr(&wstat) ;
if (pid < 0) return 0 ;
for (; i < n ; i++) if (pid == pids[i]) break ;
if (i < n) pids[i] = pids[--n] ;
}
return 1 ;
}
|