#include <sys/types.h>
#include <sys/wait.h>
#include <stdlib.h>
+#include <errno.h>
/* Number of threads. Each thread continuously spawns a fork and wait
for it. If we have another thread continuously start a step over,
{
pid_t pid;
- pid = fork ();
+ do
+ {
+ pid = fork ();
+ }
+ while (pid == -1 && errno == EINTR);
if (pid > 0)
{
int status;
/* Parent. */
- pid = waitpid (pid, &status, 0);
+ do
+ {
+ pid = waitpid (pid, &status, 0);
+ }
+ while (pid == -1 && errno == EINTR);
+
if (pid == -1)
{
perror ("wait");