From: Gaurav Sachdeva <sachdeva.gaurav@gmail.com>
To: cygwin@cygwin.com
Subject: pthread problem
Date: Fri, 05 Feb 2010 18:44:00 -0000 [thread overview]
Message-ID: <ce3537cc1002051043l57cdeef2j268592189cc9c24@mail.gmail.com> (raw)
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
next reply other threads:[~2010-02-05 18:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-05 18:44 Gaurav Sachdeva [this message]
2010-02-05 19:00 ` Christopher Faylor
2010-02-12 20:18 ` Christopher Faylor
-- strict thread matches above, loose matches on Subject: below --
2002-07-03 3:40 aloha
2002-07-03 4:06 ` Max Zaitsev
2002-07-03 13:21 ` Thomas Pfaff
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ce3537cc1002051043l57cdeef2j268592189cc9c24@mail.gmail.com \
--to=sachdeva.gaurav@gmail.com \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).