public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Václav Zeman" <vhaisman@gmail.com>
To: cygwin@cygwin.com
Subject: Re: limitations of TLS using GCC's __thread keyword and Cygwin
Date: Tue, 04 Sep 2012 20:50:00 -0000	[thread overview]
Message-ID: <50466981.70005@gmail.com> (raw)
In-Reply-To: <504612A3.6070605@cs.utoronto.ca>

[-- Attachment #1: Type: text/plain, Size: 1354 bytes --]

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.

-- 
VZ



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 291 bytes --]

  reply	other threads:[~2012-09-04 20:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-04 12:58 Václav Zeman
2012-09-04 14:40 ` Ryan Johnson
2012-09-04 20:50   ` Václav Zeman [this message]
2012-09-04 21:51     ` Christopher Faylor
2012-09-05  9:09       ` Václav Zeman
2012-09-05 14:04         ` Ryan Johnson
2012-09-05 19:55           ` Václav Zeman

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=50466981.70005@gmail.com \
    --to=vhaisman@gmail.com \
    --cc=cygwin@cygwin.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).