11541Srgrimes/* This testcase is part of GDB, the GNU debugger. 21541Srgrimes 350477Speter Copyright 2014-2023 Free Software Foundation, Inc. 41541Srgrimes 51541Srgrimes This program is free software; you can redistribute it and/or modify 61541Srgrimes it under the terms of the GNU General Public License as published by 799854Salfred the Free Software Foundation; either version 3 of the License, or 81541Srgrimes (at your option) any later version. 999854Salfred 101541Srgrimes This program is distributed in the hope that it will be useful, 111541Srgrimes but WITHOUT ANY WARRANTY; without even the implied warranty of 121541Srgrimes MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1310905Sbde GNU General Public License for more details. 1410905Sbde 151541Srgrimes You should have received a copy of the GNU General Public License 1634354Sjb along with this program. If not, see <http://www.gnu.org/licenses/>. */ 171541Srgrimes 1811294Sswallace#include <pthread.h> 1911294Sswallace#include <unistd.h> 2011294Sswallace#include <stdlib.h> 211541Srgrimes 221541Srgrimes/* Always zero, used in breakpoint condition. */ 2331627Sjmgvolatile int global_zero; 2431627Sjmg 2531627Sjmgvoid * 2699854Salfredchild_function (void *arg) 2799854Salfred{ 2831627Sjmg while (1) 2931627Sjmg { 3031627Sjmg usleep (1); /* set breakpoint child here */ 3199854Salfred } 321541Srgrimes 3399854Salfred pthread_exit (NULL); 341541Srgrimes} 3599854Salfred 3624373Speterint 371541Srgrimesmain (void) 3895258Sdes{ 391541Srgrimes pthread_t child_thread; 401541Srgrimes int res; 411541Srgrimes 421541Srgrimes res = pthread_create (&child_thread, NULL, child_function, NULL); 4336735Sdfr sleep (2); /* set wait-thread breakpoint here */ 4411294Sswallace exit (EXIT_SUCCESS); 4511294Sswallace} 4611294Sswallace