// // child.c // two threads and they are competing the console io ! // when u try input, the output thread suspends. // // #include <conio.h> #include <iostream> #include <windows.h> #include <process.h> // needed for _beginthread() void silly( void * ); // function prototype void silly2( void * ); using namespace std; HANDLE hMutex; DWORD exitCode; int main() { printf( "in the main() function./n" ); hMutex = CreateMutex( NULL, FALSE, NULL );//create Mutex Objects!! sharing io need it! HANDLE hThread=(HANDLE)_beginthread( silly, 0, (void*)12 ); HANDLE hThread2=(HANDLE)_beginthread( silly2, 0,(void*)9); // GetExitCodeThread(hThread, &exitCode); //if ( exitCode != STILL_ACTIVE ) // return 0; WaitForSingleObject(hThread,INFINITE);// WaitForSingleO