[bug?] 2nd printf output gets gobbled up when 1st used in a thread
furrylogical
furrylogical@gmail.com
Tue Jan 1 21:16:00 GMT 2013
Hello everyone,
Cygwin seems to behave strangely when `printf` is used in threads: if
the first `printf` encountered occurs in another thread, then the
first `printf` that occurs in the main function will vanish into thin
air. The following fragment illustrates this:
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
void *func(void *arg)
{
printf("thread_printf\n");
return NULL;
}
int main(int argc, char **argv)
{
pthread_t thread;
pthread_create(&thread, NULL, func, NULL);
pthread_join(thread, NULL);
printf("main_printf1\n"); /* This line never gets printed */
printf("main_printf2\n");
return 0;
}
When compiled with `gcc` with no options, the output is:
thread_printf
main_printf2
I'm not familiar with the Cygwin codebase. If someone can point me in
the right direction, I might be able to figure out what is causing
this issue.
I appreciate the if someone can help me figure this out, though I
understand it's not exactly a critical issue. Thanks all.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 125062 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20130101/a7c903a6/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.c
Type: text/x-csrc
Size: 392 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20130101/a7c903a6/attachment.bin>
-------------- next part --------------
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list