/* This testcase is part of GDB, the GNU debugger.
- Copyright 2008, 2009 Free Software Foundation, Inc.
+ Copyright 2008-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#define NUMTHREADS 10
volatile int done = 0;
+static pthread_barrier_t barrier;
static void *
start (void *arg)
printf ("Thread <%d> executing\n", x);
+ pthread_barrier_wait (&barrier);
+
while (!done)
usleep (100);
printf ("Thread forker <%d> executing\n", x);
+ pthread_barrier_wait (&barrier);
+
switch ((pid = fork ()))
{
case -1:
int args[NUMTHREADS];
int i, j;
+ alarm (600);
+
+ i = pthread_barrier_init (&barrier, NULL, NUMTHREADS);
+ assert (i == 0);
+
/* Create a few threads that do mostly nothing, and then one that
forks. */
for (j = 0; j < NUMTHREADS - 1; ++j)