1 /* This testcase is part of GDB, the GNU debugger.
3 Copyright 2022 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 #include <sys/types.h>
26 /* Number of threads doing forks. */
34 pid_t pid
= FORK_FUNC ();
41 /* Wait for children to exit. */
45 ret
= waitpid (pid
, &stat
, 0);
46 } while (ret
== EINTR
);
49 assert (WIFEXITED (stat
));
50 assert (WEXITSTATUS (stat
) == 11);
69 pthread_t thread
[N_FORKERS
];
70 for (int i
= 0; i
< N_FORKERS
; ++i
)
72 int ret
= pthread_create (&thread
[i
], NULL
, forker
, NULL
);
76 for (int i
= 0; i
< INT_MAX
; ++i
) /* for loop */
78 sleep_a_bit (); /* break here */
79 sleep_a_bit (); /* other line */
82 for (int i
= 0; i
< N_FORKERS
; ++i
)
83 pthread_join (thread
[i
], NULL
);
This page took 0.033276 seconds and 4 git commands to generate.