Fix racy FAILs.
* gdb.threads/fork-thread-pending.c (barrier): New variable.
(thread_function, thread_forker): Call pthread_barrier_wait for it.
(main): Call pthread_barrier_init for it.
+2011-12-26 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Fix racy FAILs.
+ * gdb.threads/fork-thread-pending.c (barrier): New variable.
+ (thread_function, thread_forker): Call pthread_barrier_wait for it.
+ (main): Call pthread_barrier_init for it.
+
2011-12-26 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix double send_gdb leading to racy FAILs.
#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;
+ 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)