pthread problem
Gaurav Sachdeva
sachdeva.gaurav@gmail.com
Fri Feb 5 18:44:00 GMT 2010
Hi,
I have written following code -
#include<stdio.h>
void *thread_func(void *data)
{
printf("In thread\n");
pthread_exit(NULL);
}
int main()
{
pthread_t mythread;
int rc;
rc = pthread_create(&mythread, NULL, thread_func, NULL);
if (rc){
printf("ERROR; return code from pthread_create() is %d\n", rc);
exit(-1);
}
printf("In main..\n");
pthread_exit(NULL);
}
It must print both "In main" and "In thread".
But sometimes it prints one of these two and sometimes both.
I tried in actual UNIX OS. It always prints both.
I also tried in c++ in cygwin, problem exists there also.
Is anyone aware of this problem and its solutions?
Thanks,
Gaurav
--
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