public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* pthread problem
@ 2002-07-03  3:40 aloha
  2002-07-03  4:06 ` Max Zaitsev
  2002-07-03 13:21 ` Thomas Pfaff
  0 siblings, 2 replies; 6+ messages in thread
From: aloha @ 2002-07-03  3:40 UTC (permalink / raw)
  To: cygwin

I have a multi-threaded application written in C++ that works fins in
linux, solaris and windows, but crashes in cygwin, and I even cannot
debug it with gdb in cygwin, when I run it, I just got a sigsegv, and
the stack seems to be corrupted, usually in a function
"_libkernel32_a_iname", and the source window outputs "Unable to Read
Instructions at 0x6106c7d0"
Can anyone help me ?
thanks
rgds
aloha




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: pthread problem
  2002-07-03  3:40 pthread problem aloha
@ 2002-07-03  4:06 ` Max Zaitsev
  2002-07-03 13:21 ` Thomas Pfaff
  1 sibling, 0 replies; 6+ messages in thread
From: Max Zaitsev @ 2002-07-03  4:06 UTC (permalink / raw)
  To: aloha, cygwin

I'm suffering from the similar problem. Just posted a question here today. 
When I used older version of cygwin, GDB used to crash somewhere in the 
static objects initialization, with 1.3.11 it goes a bit further, but not 
far. and without debugger my program runs just until first wait conditions 
are used.

--Max

On Wednesday 03 July 2002 12:38, aloha wrote:
>  I have a multi-threaded application written in C++ that works fins in
>  linux, solaris and windows, but crashes in cygwin, and I even cannot
>  debug it with gdb in cygwin, when I run it, I just got a sigsegv, and
>  the stack seems to be corrupted, usually in a function
>  "_libkernel32_a_iname", and the source window outputs "Unable to Read
>  Instructions at 0x6106c7d0"
>  Can anyone help me ?
>  thanks
>  rgds
>  aloha



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: pthread problem
  2002-07-03  3:40 pthread problem aloha
  2002-07-03  4:06 ` Max Zaitsev
@ 2002-07-03 13:21 ` Thomas Pfaff
  1 sibling, 0 replies; 6+ messages in thread
From: Thomas Pfaff @ 2002-07-03 13:21 UTC (permalink / raw)
  To: aloha; +Cc: cygwin



On Wed, 3 Jul 2002, aloha wrote:

> I have a multi-threaded application written in C++ that works fins in
> linux, solaris and windows, but crashes in cygwin, and I even cannot
> debug it with gdb in cygwin, when I run it, I just got a sigsegv, and
> the stack seems to be corrupted, usually in a function
> "_libkernel32_a_iname", and the source window outputs "Unable to Read
> Instructions at 0x6106c7d0"
> Can anyone help me ?
> thanks
> rgds
> aloha
>
>

If you could send me your sources i will take a look at it.

Thomas


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: pthread problem
  2010-02-05 19:00 ` Christopher Faylor
@ 2010-02-12 20:18   ` Christopher Faylor
  0 siblings, 0 replies; 6+ messages in thread
From: Christopher Faylor @ 2010-02-12 20:18 UTC (permalink / raw)
  To: cygwin

On Fri, Feb 05, 2010 at 02:00:07PM -0500, Christopher Faylor wrote:
>On Sat, Feb 06, 2010 at 12:13:59AM +0530, Gaurav Sachdeva wrote:
>>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?
>
>Looks like a bug in Cygwin.  From my reading of the pthread_exit man
>page, it looks like it should wait for all available threads to exit
>before the process exits.  Unfortunately that doesn't happen.
>
>You can probably fix that by adding a pthread_join() before the
>pthread_exit().
>
>In the meantime, I'll look into fixing this.

This should be fixed in today's snapshot.  Thanks for the test case.

cgf

--
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: pthread problem
  2010-02-05 18:44 Gaurav Sachdeva
@ 2010-02-05 19:00 ` Christopher Faylor
  2010-02-12 20:18   ` Christopher Faylor
  0 siblings, 1 reply; 6+ messages in thread
From: Christopher Faylor @ 2010-02-05 19:00 UTC (permalink / raw)
  To: cygwin

On Sat, Feb 06, 2010 at 12:13:59AM +0530, Gaurav Sachdeva wrote:
>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?

Looks like a bug in Cygwin.  From my reading of the pthread_exit man
page, it looks like it should wait for all available threads to exit
before the process exits.  Unfortunately that doesn't happen.

You can probably fix that by adding a pthread_join() before the
pthread_exit().

In the meantime, I'll look into fixing this.

cgf

--
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* pthread problem
@ 2010-02-05 18:44 Gaurav Sachdeva
  2010-02-05 19:00 ` Christopher Faylor
  0 siblings, 1 reply; 6+ messages in thread
From: Gaurav Sachdeva @ 2010-02-05 18:44 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-02-12 20:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-03  3:40 pthread problem aloha
2002-07-03  4:06 ` Max Zaitsev
2002-07-03 13:21 ` Thomas Pfaff
2010-02-05 18:44 Gaurav Sachdeva
2010-02-05 19:00 ` Christopher Faylor
2010-02-12 20:18   ` Christopher Faylor

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).