1 extern int debug_threads; 2 extern void sigsuspend (void); my_waitpid(int flags,int wnohang)3void my_waitpid (int flags, int wnohang) 4 { 5 while (1) 6 { 7 if (flags & 0x80000000) 8 { 9 if (wnohang) 10 break; 11 if (debug_threads) 12 __builtin_puts ("blocking\n"); 13 sigsuspend (); 14 } 15 flags ^= 0x80000000; 16 } 17 } 18 19