From: Kereszt@crossys.com
To: pthreads-win32@sources.redhat.com
Subject: Re: pthread_exit() does not call the cleanups
Date: Fri, 12 Nov 2004 17:01:00 -0000 [thread overview]
Message-ID: <20041112170106.GE2444@cross> (raw)
In-Reply-To: <4194EB9F.6050002@tatramed.sk>
[-- Attachment #1: Type: text/plain, Size: 578 bytes --]
Sorry.. here it is.
Thanks
> Well, but the attachment is missing...
>
> Regards
> Peter Slacik
>
> Kereszt@crossys.com wrote:
>
> >Hello,
> >
> >I've found that with pthread-win32 the pthread_exit() does not call the
> >previously pushed (pthread_cleanup_push()) cleanup routines. I've just
> >tried
> >it on a linux box and it works as documented (does the call).
> >
> >I'm a bit newbie to pthread so it might be my fault. I've attached a little
> >sample code which reproduces the problem.
> >
> >Please, tell me what's the deal!
> >
> >Thanks,
> >Laszlo
> >
> >
--
[-- Attachment #2: test.cpp --]
[-- Type: text/plain, Size: 572 bytes --]
#ifdef _WIN32
# include <Windows.h>
#else
# include <unistd.h>
#endif
#include <stdio.h>
#include "pthread.h"
void cleanup (void *p)
{
fprintf (stderr, "cleanup\n");
}
void *t (void *)
{
pthread_cleanup_push (cleanup, NULL);
for (int i = 0; i < 5; i++) {
fprintf (stderr, "do...\n");
#ifdef _WIN32
Sleep (1000);
#else
sleep (1);
#endif
pthread_exit (NULL);
}
pthread_cleanup_pop (1);
return NULL;
}
int main ()
{ pthread_t t1;
pthread_create (&t1, NULL, t, NULL);
pthread_join (t1, NULL);
fprintf (stderr, "return\n");
getchar ();
return 0;
}
next prev parent reply other threads:[~2004-11-12 17:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-12 16:51 Kereszt
[not found] ` <4194EB9F.6050002@tatramed.sk>
2004-11-12 17:01 ` Kereszt [this message]
2004-11-12 19:29 ` Kereszt
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=20041112170106.GE2444@cross \
--to=kereszt@crossys.com \
--cc=pthreads-win32@sources.redhat.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).