Update year range in copyright notice of all files owned by the GDB project.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.threads / fork-thread-pending.c
index 34ea52d3f92dc230ce941dc188e115c323accf42..883bdbc43ee8dbe71df1d9fcb4600348d8beb517 100644 (file)
@@ -1,6 +1,6 @@
 /* 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
@@ -28,6 +28,7 @@
 #define NUMTHREADS 10
 
 volatile int done = 0;
+static pthread_barrier_t barrier;
 
 static void *
 start (void *arg)
@@ -45,6 +46,8 @@ thread_function (void *arg)
 
   printf ("Thread <%d> executing\n", x);
 
+  pthread_barrier_wait (&barrier);
+
   while (!done)
     usleep (100);
 
@@ -62,6 +65,8 @@ thread_forker (void *arg)
 
   printf ("Thread forker <%d> executing\n", x);
 
+  pthread_barrier_wait (&barrier);
+
   switch ((pid = fork ()))
     {
     case -1:
@@ -89,6 +94,11 @@ main (void)
   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)
This page took 0.029792 seconds and 4 git commands to generate.