OLD | NEW |
1 /* Manythreads test program. | 1 /* Manythreads test program. |
2 Copyright 2004, 2006-2012 Free Software Foundation, Inc. | 2 Copyright 2004-2013 Free Software Foundation, Inc. |
3 | 3 |
4 Written by Jeff Johnston <jjohnstn@redhat.com> | 4 Written by Jeff Johnston <jjohnstn@redhat.com> |
5 Contributed by Red Hat | 5 Contributed by Red Hat |
6 | 6 |
7 This file is part of GDB. | 7 This file is part of GDB. |
8 | 8 |
9 This program is free software; you can redistribute it and/or modify | 9 This program is free software; you can redistribute it and/or modify |
10 it under the terms of the GNU General Public License as published by | 10 it under the terms of the GNU General Public License as published by |
11 the Free Software Foundation; either version 3 of the License, or | 11 the Free Software Foundation; either version 3 of the License, or |
12 (at your option) any later version. | 12 (at your option) any later version. |
13 | 13 |
14 This program is distributed in the hope that it will be useful, | 14 This program is distributed in the hope that it will be useful, |
15 but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 GNU General Public License for more details. | 17 GNU General Public License for more details. |
18 | 18 |
19 You should have received a copy of the GNU General Public License | 19 You should have received a copy of the GNU General Public License |
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
21 | 21 |
22 #include <pthread.h> | 22 #include <pthread.h> |
| 23 #ifdef DEBUG |
23 #include <stdio.h> | 24 #include <stdio.h> |
| 25 #endif |
24 #include <limits.h> | 26 #include <limits.h> |
25 | 27 |
26 void * | 28 void * |
27 thread_function (void *arg) | 29 thread_function (void *arg) |
28 { | 30 { |
29 int x = * (int *) arg; | 31 int x = * (int *) arg; |
30 | 32 |
| 33 #ifdef DEBUG |
31 printf ("Thread <%d> executing\n", x); | 34 printf ("Thread <%d> executing\n", x); |
| 35 #endif /* DEBUG */ |
32 | 36 |
33 return NULL; | 37 return NULL; |
34 } | 38 } |
35 | 39 |
36 int | 40 int |
37 main (int argc, char **argv) | 41 main (int argc, char **argv) |
38 { | 42 { |
39 pthread_attr_t attr; | 43 pthread_attr_t attr; |
40 pthread_t threads[256]; | 44 pthread_t threads[256]; |
41 int args[256]; | 45 int args[256]; |
(...skipping 18 matching lines...) Expand all Loading... |
60 for (j = 0; j < 256; ++j) | 64 for (j = 0; j < 256; ++j) |
61 { | 65 { |
62 pthread_join (threads[j], NULL); | 66 pthread_join (threads[j], NULL); |
63 } | 67 } |
64 } | 68 } |
65 | 69 |
66 pthread_attr_destroy (&attr); | 70 pthread_attr_destroy (&attr); |
67 | 71 |
68 return 0; | 72 return 0; |
69 } | 73 } |
OLD | NEW |