From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28744 invoked by alias); 12 Nov 2004 17:01:36 -0000 Mailing-List: contact pthreads-win32-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: pthreads-win32-owner@sources.redhat.com Received: (qmail 28471 invoked from network); 12 Nov 2004 17:01:20 -0000 Received: from unknown (HELO crossys.com) (80.98.38.32) by sourceware.org with SMTP; 12 Nov 2004 17:01:20 -0000 Received: from Kereszt by crossys.com with local (Exim 4.32) id I72SLU-0002F8-BW for pthreads-win32@sources.redhat.com; Fri, 12 Nov 2004 18:01:06 +0100 Date: Fri, 12 Nov 2004 17:01:00 -0000 From: Kereszt@crossys.com To: pthreads-win32@sources.redhat.com Subject: Re: pthread_exit() does not call the cleanups Message-ID: <20041112170106.GE2444@cross> References: <20041112165053.GD2444@cross> <4194EB9F.6050002@tatramed.sk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="0ntfKIWw70PvrIHh" Content-Disposition: inline In-Reply-To: <4194EB9F.6050002@tatramed.sk> User-Agent: Mutt/1.4.1i X-SW-Source: 2004/txt/msg00140.txt.bz2 --0ntfKIWw70PvrIHh Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-length: 578 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 > > > > -- --0ntfKIWw70PvrIHh Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: attachment; filename="test.cpp" Content-length: 572 #ifdef _WIN32 # include #else # include #endif #include #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; } --0ntfKIWw70PvrIHh--