1 /* Pthreads test program.
2 Copyright 1996-2021 Free Software Foundation, Inc.
4 Written by Keith Seitz of Red Hat.
5 Copied from gdb.threads/pthreads.c.
6 Contributed by Red Hat.
8 This file is part of GDB.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>. */
31 /* When gdb is running, it sets hidden breakpoints in the thread
32 library. The signals caused by these hidden breakpoints can
33 cause system calls such as 'sleep' to return early. Pay attention
34 to the return value from 'sleep' to get the full sleep. */
37 unslept
= sleep (unslept
);
39 printf ("hello thread\n");
42 /* Marker function for the testsuite */
44 done_making_threads (void)
54 if (pthread_create (&tid
, NULL
, routine
, (void *) 0xfeedface))
56 perror ("pthread_create 1");
62 main (int argc
, char *argv
[])
66 /* Create a few threads */
67 for (i
= 0; i
< 5; i
++)
69 done_making_threads ();