public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
* RE: pthread_exit bug ?
@ 1999-09-02 14:29 Bossom, John
  0 siblings, 0 replies; 5+ messages in thread
From: Bossom, John @ 1999-09-02 14:29 UTC (permalink / raw)
  To: 'Milan Gardian', 'Tristan Savatier', pthreads-win32

Yes... Unless you call pthread_exit from the main line, you will
not have any of your thread-specific-destroy routines called for the
main-line.

(I believe this is documented in one of the PThreads books by Bil Lewis)


John.

-----Original Message-----
From: Milan Gardian [ mailto:mg@tatramed.sk ]
Sent: Thursday, September 02, 1999 6:36 AM
To: 'Tristan Savatier'; pthreads-win32@sourceware.cygnus.com
Subject: RE: pthread_exit bug ?


[snip]
> My program creates several threads.  At termination,
> each thread (except the main thread) terminates by calling
> pthread_exit, then the main thread terminates by
> calling pthread_exit (at this point, all my threads
> are terminated, therefore the process should disapear).

(This note does not try to diminish the meaning of the reported bug)
Q: Is there a reason to use pthread_exit from the main thread? A special
functionality prehaps? Specifically, I would like to know if there's some
difference between these two code snips:

(a)
int main(void)
{
    //Do some threading stuff...
    return (24);
}


(b)
void main(void)
{
    //Do some threading stuff...
    pthread_exit(24);
}

From the rather ideological reasons  :) I prefer the (a) version, but will
gladly learn if there's a point in the (b) version.

Looking forward to anyone answering;
Yours sincerely,
	Milan G.

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

* RE: pthread_exit bug ?
  1999-09-02  2:43 ` pthread_exit bug ? Tristan Savatier
  1999-09-02  3:06   ` Peter Slacik
  1999-09-02  3:22   ` Ross Johnson
@ 1999-09-02  3:35   ` Milan Gardian
  2 siblings, 0 replies; 5+ messages in thread
From: Milan Gardian @ 1999-09-02  3:35 UTC (permalink / raw)
  To: 'Tristan Savatier', pthreads-win32

[snip]
> My program creates several threads.  At termination,
> each thread (except the main thread) terminates by calling
> pthread_exit, then the main thread terminates by
> calling pthread_exit (at this point, all my threads
> are terminated, therefore the process should disapear).

(This note does not try to diminish the meaning of the reported bug)
Q: Is there a reason to use pthread_exit from the main thread? A special
functionality prehaps? Specifically, I would like to know if there's some
difference between these two code snips:

(a)
int main(void)
{
    //Do some threading stuff...
    return (24);
}


(b)
void main(void)
{
    //Do some threading stuff...
    pthread_exit(24);
}

From the rather ideological reasons  :) I prefer the (a) version, but will
gladly learn if there's a point in the (b) version.

Looking forward to anyone answering;
Yours sincerely,
	Milan G.

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

* Re: pthread_exit bug ?
  1999-09-02  2:43 ` pthread_exit bug ? Tristan Savatier
  1999-09-02  3:06   ` Peter Slacik
@ 1999-09-02  3:22   ` Ross Johnson
  1999-09-02  3:35   ` Milan Gardian
  2 siblings, 0 replies; 5+ messages in thread
From: Ross Johnson @ 1999-09-02  3:22 UTC (permalink / raw)
  To: Tristan Savatier; +Cc: pthreads-win32

Tristan,

Please try pthreads-win32-snap-1999-08-12 with your code. It fixes a
bug in pthread_exit.

ftp://sourceware.cygnus.com/pub/pthreads-win32/dll-latest

I'm about to create a new snapshot so keep a lookout for that one
also.

Cheers.
Ross 

On Thu, 2 Sep 1999, Tristan Savatier wrote:

> I am currently using pthreads-win32-snap-1999-05-30,
> using VC++ 6.0 under Win98.
> 
> My program creates several threads.  At termination,
> each thread (except the main thread) terminates by calling
> pthread_exit, then the main thread terminates by
> calling pthread_exit (at this point, all my threads
> are terminated, therefore the process should disapear).
> 
> This works fine with native pthread libraries on
> Linux and other Posix systems.
> 
> But I noticed that with pthreads-win32, calling pthread_exit 
> to terminate my main thread does not work well: the process survives
> with two dangling threads (both threads are some type
> of internal kernel threads, not running any of my code).
> 
> If I call exit(0) [instead of pthread_exit] to terminate
> my main thread, the process terminates properly (i.e.
> this is a workaround).
> 
> This looks like a bug: the pthread standard says,
> in the pthread_exit specification:
> <<When the last thread in a process exits, exit(0)
> will be called.>>
> 
> Is that a known bug ?
> 
> -t
> 

+----------------------+---+
| Ross Johnson         |   | E-Mail: rpj@ise.canberra.edu.au
| Info Sciences and Eng|___|
| University of Canberra   | FAX:    +61 6 2015227
| PO Box 1                 |
| Belconnen  ACT    2616   | WWW:    http://willow.canberra.edu.au/~rpj/
| AUSTRALIA                |
+--------------------------+


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

* Re: pthread_exit bug ?
  1999-09-02  2:43 ` pthread_exit bug ? Tristan Savatier
@ 1999-09-02  3:06   ` Peter Slacik
  1999-09-02  3:22   ` Ross Johnson
  1999-09-02  3:35   ` Milan Gardian
  2 siblings, 0 replies; 5+ messages in thread
From: Peter Slacik @ 1999-09-02  3:06 UTC (permalink / raw)
  To: Tristan Savatier; +Cc: Pthreads-Win32 Mailing List

Tristan Savatier wrote:

> I am currently using pthreads-win32-snap-1999-05-30,
> using VC++ 6.0 under Win98.
>
> My program creates several threads.  At termination,
> each thread (except the main thread) terminates by calling
> pthread_exit, then the main thread terminates by
> calling pthread_exit (at this point, all my threads
> are terminated, therefore the process should disapear).
>
> This works fine with native pthread libraries on
> Linux and other Posix systems.
>
> But I noticed that with pthreads-win32, calling pthread_exit
> to terminate my main thread does not work well: the process survives
> with two dangling threads (both threads are some type
> of internal kernel threads, not running any of my code).
>
> If I call exit(0) [instead of pthread_exit] to terminate
> my main thread, the process terminates properly (i.e.
> this is a workaround).
>
> This looks like a bug: the pthread standard says,
> in the pthread_exit specification:
> <<When the last thread in a process exits, exit(0)
> will be called.>>
>
> Is that a known bug ?

Yes, I noticed this already and tried to find out possible workarounds, but
I forgot this problem later, because my application calls exit().

I'm not sure but I remember that last year's snapshots behaved correctly...

Peter Slacik



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

* pthread_exit bug ?
  1999-08-18  4:45 Return values Milan Gardian
@ 1999-09-02  2:43 ` Tristan Savatier
  1999-09-02  3:06   ` Peter Slacik
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tristan Savatier @ 1999-09-02  2:43 UTC (permalink / raw)
  To: pthreads-win32

I am currently using pthreads-win32-snap-1999-05-30,
using VC++ 6.0 under Win98.

My program creates several threads.  At termination,
each thread (except the main thread) terminates by calling
pthread_exit, then the main thread terminates by
calling pthread_exit (at this point, all my threads
are terminated, therefore the process should disapear).

This works fine with native pthread libraries on
Linux and other Posix systems.

But I noticed that with pthreads-win32, calling pthread_exit 
to terminate my main thread does not work well: the process survives
with two dangling threads (both threads are some type
of internal kernel threads, not running any of my code).

If I call exit(0) [instead of pthread_exit] to terminate
my main thread, the process terminates properly (i.e.
this is a workaround).

This looks like a bug: the pthread standard says,
in the pthread_exit specification:
<<When the last thread in a process exits, exit(0)
will be called.>>

Is that a known bug ?

-t

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

end of thread, other threads:[~1999-09-02 14:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-02 14:29 pthread_exit bug ? Bossom, John
  -- strict thread matches above, loose matches on Subject: below --
1999-08-18  4:45 Return values Milan Gardian
1999-09-02  2:43 ` pthread_exit bug ? Tristan Savatier
1999-09-02  3:06   ` Peter Slacik
1999-09-02  3:22   ` Ross Johnson
1999-09-02  3:35   ` Milan Gardian

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