* printcmd.c (print_address_demangle): Remove special case for 0.
[platform/upstream/binutils.git] / gdb / testsuite / gdb.mi / non-stop-exit.c
1 /* Test program exit in non-stop mode.
2    Copyright 2009-2012 Free Software Foundation, Inc.
3
4    This file is part of GDB.
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
18
19 #include <pthread.h>
20 #include <stdio.h>
21
22 #define NTHREADS 4
23 void* thread_function (void*);
24
25 void *
26 thread_function (void *arg)
27 {
28   int x = * (int *) arg;
29
30   printf ("Thread <%d> executing\n", x);
31
32   return NULL;
33 }
34
35 int
36 main ()
37 {
38   pthread_t thread_id[NTHREADS];
39   int args[NTHREADS];
40   int i;
41
42   for (i = 0; i < NTHREADS; ++i)
43     {
44       args[i] = i;
45       pthread_create (&thread_id[i], NULL, thread_function, &args[i]);
46     }
47
48   for (i = 0; i < NTHREADS; ++i)
49     {
50       pthread_join (thread_id[i], NULL); 
51     }
52
53   return 0;
54 }