1 /* This testcase is part of GDB, the GNU debugger.
3 Copyright 2002, 2003, 2004, 2007, 2008, 2009, 2010, 2011
4 Free Software Foundation, Inc.
6 Copyright 1992, 1993, 1994, 1995, 1999, 2002, 2003, 2007, 2008, 2009
7 Free Software Foundation, Inc.
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
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
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/>.
22 This file is copied from schedlock.c. */
29 void *thread_function (void *arg
); /* Pointer to function executed by each thread */
33 static unsigned int shared_var
= 1;
37 pthread_t threads
[NUM
];
41 for (i
= 0; i
< NUM
; i
++)
43 res
= pthread_create (&threads
[i
],
49 thread_result
= thread_function ((void *) i
);
54 void *thread_function (void *arg
) {
55 int my_number
= (long) arg
;
56 /* Don't run forever. Run just short of it :) */
57 while (shared_var
> 0)
60 usleep (1); /* Loop increment. */
This page took 0.031897 seconds and 4 git commands to generate.