This is the mail archive of the cygwin-talk mailing list for the cygwin project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi, I've attached simple cpp program which demonstrates the problem. The program works fine from cmd.exe, but fails when started from cygwin. The program does the following: - The main thread creates a helper thread which reads stdin and prints the data read. - stdin is read via ReadFile() Win32 API function. - At the end of the main function, the main thread calls CloseHandle() func for the stdin. It causes the ReadFile() function to return, and the helper thread to finish. From cmd the program works as described. - Under Cygwin the program works differently. The helper thread is not finished, because it doesn't exit from the ReadFile() func. The main thread waits for the helper thread's completion during 1 sec, then it calls TerminateThread() Win32 API func. When I start the program from cmd, I see the following output: >read_stdin_example.exe Stdin_Reader_Thread has been completed When I start the program from Cygwin, I see: $ ./read_stdin_example.exe Stdin_Reader_Thread has NOT been completed. So, it will be terminated. I believe that this information would be enough to investigate and fix the problem. If you need more information or have questions, feel free to contact me. Have a nice day! ~Alexey
Attachment:
main.cpp
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |