1 /* Test program exit in non-stop mode.
2 Copyright 2009-2012 Free Software Foundation, Inc.
4 This file is part of GDB.
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.
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.
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/>. */
23 void* thread_function (void*);
26 thread_function (void *arg)
28 int x = * (int *) arg;
30 printf ("Thread <%d> executing\n", x);
38 pthread_t thread_id[NTHREADS];
42 for (i = 0; i < NTHREADS; ++i)
45 pthread_create (&thread_id[i], NULL, thread_function, &args[i]);
48 for (i = 0; i < NTHREADS; ++i)
50 pthread_join (thread_id[i], NULL);