From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26177 invoked by alias); 7 Feb 2002 03:06:32 -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 26120 invoked from network); 7 Feb 2002 03:06:30 -0000 Received: from unknown (HELO real.ise.canberra.edu.au) (137.92.140.34) by sources.redhat.com with SMTP; 7 Feb 2002 03:06:30 -0000 Received: from setup1.ise.canberra.edu.au (IDENT:root@setup1.ise.canberra.edu.au [137.92.140.41]) by real.ise.canberra.edu.au (8.9.3/8.8.7) with ESMTP id OAA01447; Thu, 7 Feb 2002 14:06:20 +1100 Received: from ise.canberra.edu.au (IDENT:rpj@localhost.localdomain [127.0.0.1]) by setup1.ise.canberra.edu.au (8.9.3/8.8.7) with ESMTP id OAA01025; Thu, 7 Feb 2002 14:06:19 +1100 Message-ID: <3C61EF2B.399E3428@ise.canberra.edu.au> Date: Wed, 06 Feb 2002 19:06:00 -0000 From: Ross Johnson Organization: University of Canberra, Information Sciences and Engineering X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.2.12-20 i686) X-Accept-Language: en MIME-Version: 1.0 To: Aurelio Medina CC: pthreads-win32@sources.redhat.com, Pat Bacon Subject: Re: Problem using PThreads TLS from a DLL. References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2002/txt/msg00006.txt.bz2 Aurelio Medina wrote: > > Hello all, > > I've encountered a problem when using the PThreads-Win32 (PThreadVCE) > thread local storage (TLS) routines from within my own DLL. Before I > dig any deeper I would like to know if anyone has seen this and/or has > a workaround. My DLL is calloc'ing TLS data and I believe the TLS > destructors (which I have calling free) are firing within the main app > and not within my DLL. This causes the app that uses my DLL to crash > in the TLS destructor when calling free. It crashes beacuse the app is > trying to free CRT memory allocated by my DLL. Is there some PThread > function that I can call in my DLLMain to cause the TLS destructors to > fire when my DLL is detached? Do I understand the problem correctly: is this because the memory is unallocated when your DLL is unloaded and therefore free() segfaults? Are you able to join those threads before unloading your DLL? Pthread_join() will call the destructors for you when the threads exit. Ross > > Thanks, > Aurelio Medina -- +-------------------------+---+ | Ross Johnson | | "Come down off the cross | Management & Technology |___| We can use the wood" - Tom Waits | Building 11 | | University of Canberra | eMail: rpj@ise.canberra.edu.au | ACT 2601 | WWW: http://public.ise.canberra.edu.au/~rpj/ | AUSTRALIA | +-----------------------------+