From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32264 invoked by alias); 4 Sep 2012 21:51:46 -0000 Received: (qmail 32247 invoked by uid 22791); 4 Sep 2012 21:51:45 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mho-01-ewr.mailhop.org (HELO mho-01-ewr.mailhop.org) (204.13.248.71) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 04 Sep 2012 21:51:31 +0000 Received: from pool-173-76-55-36.bstnma.fios.verizon.net ([173.76.55.36] helo=cgf.cx) by mho-01-ewr.mailhop.org with esmtpa (Exim 4.72) (envelope-from ) id 1T911u-000FQe-T9 for cygwin@cygwin.com; Tue, 04 Sep 2012 21:51:30 +0000 Received: from localhost (ednor.casa.cgf.cx [192.168.187.5]) by cgf.cx (Postfix) with ESMTP id EB06342800E for ; Tue, 4 Sep 2012 17:51:29 -0400 (EDT) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1/QuR8IXjAXXIkLZuCs+xih Date: Tue, 04 Sep 2012 21:51:00 -0000 From: Christopher Faylor To: cygwin@cygwin.com Subject: Re: limitations of TLS using GCC's __thread keyword and Cygwin Message-ID: <20120904215129.GA30731@ednor.casa.cgf.cx> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <504612A3.6070605@cs.utoronto.ca> <50466981.70005@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <50466981.70005@gmail.com> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2012-09/txt/msg00055.txt.bz2 On Tue, Sep 04, 2012 at 10:50:09PM +0200, V??clav Zeman wrote: >On 09/04/2012 04:39 PM, Ryan Johnson wrote: >> On 04/09/2012 8:58 AM, V??clav Zeman wrote: >>> Hi. >>> >>> I am am porting a library that can use the __thread keyword in its >>> internals to provide thread local storage. Now, with MSVC there is a >>> limitation on pre-Vista Windows (see [1]) that DLLs using >>> __declspec(thread) (MSVC equivalent of GCC's __thread) cannot be >>> loaded using LoadLibrary() because pre-Vista Windows allocate the TLS >>> declared that way only on process startup. Vista and later Windows do >>> not seem to have the limitation. Since Cygwin officially still >>> supports at least Windows XP, I want to provide a library that works >>> there as well. >>> >>> Does Cygwin's GCC and its TLS emulation work around this problem? IOW, >>> are Cygwin DLLs using TLS declared using __thread keyword safe to be >>> loaded using LoadLibrary()/dlopen() or are they not safe to be loaded >>> that way? >>> >>> [1] http://msdn.microsoft.com/en-us/library/2s9wt68x.aspx >>> >> I suspect it's not a problem, but if I were you I'd write a simple >> test program to see. Unfortunately, TLS in general seems broken on my >> machine when I tried it, but that might be due to my home-brew gcc >> being configured wrong or something. >I would have done that already but I do not have any Windows XP machine >to try this on. I don't believe that __thread is implemented on Cygwin. 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