17055Sdg/* This testcase is part of GDB, the GNU debugger. 221830Sjoerg 321830Sjoerg Copyright 2007-2020 Free Software Foundation, Inc. 47055Sdg 57055Sdg This program is free software; you can redistribute it and/or modify 67055Sdg it under the terms of the GNU General Public License as published by 77055Sdg the Free Software Foundation; either version 3 of the License, or 87055Sdg (at your option) any later version. 97055Sdg 107055Sdg This program is distributed in the hope that it will be useful, 117055Sdg but WITHOUT ANY WARRANTY; without even the implied warranty of 127055Sdg MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 137055Sdg GNU General Public License for more details. 147055Sdg 157055Sdg You should have received a copy of the GNU General Public License 167055Sdg along with this program. If not, see <http://www.gnu.org/licenses/>. */ 177055Sdg 187055Sdg/* This program is intended to be started outside of gdb, and then 197055Sdg attached to by gdb. It loops for a while, but not forever. */ 207055Sdg 217055Sdg#include <unistd.h> 227055Sdg#include <pthread.h> 237055Sdg 247055Sdgstatic void * 257055Sdgthread_func (void *arg) 267055Sdg{ 277055Sdg int i; 287055Sdg 297055Sdg for (i = 0; i < 120; i++) 307055Sdg sleep (1); 317055Sdg 327055Sdg return NULL; 337055Sdg} 347055Sdg 357061Sdgint main () 3650477Speter{ 377055Sdg int i; 387055Sdg pthread_t thread; 3932356Seivind 4032350Seivind pthread_create (&thread, NULL, thread_func, NULL); 4154263Sshin 4231742Seivind for (i = 0; i < 120; i++) 43105577Srwatson sleep (1); 4431742Seivind 457055Sdg pthread_join (thread, NULL); 467055Sdg 4793375Smdodd return 0; 48105577Srwatson} 4993375Smdodd