Threads and static initialization.

Robert Jacques sandford at jhu.edu
Sat Dec 18 12:57:50 PST 2010


On Sat, 18 Dec 2010 03:27:22 -0700, Pelle Månsson  
<pelle.mansson at gmail.com> wrote:

> On 12/18/2010 10:00 AM, Jonathan M Davis wrote:
>> The problem is that the OP wants the static constructors to be skipped.  
>> If
>> they're skipped, anything and everything which could be affected by  
>> that can't be
>> used. That pretty much means not using TLS, since the compiler isn't  
>> going to be
>> able to track down which variables in TLS will or won't be affected by  
>> it. So,
>> you're stuck using shared memory only. _That_ is where the problem  
>> comes in.
>
> Exactly, not using TLS. You can still use the heap, as it is not thread  
> local. Meaning you can create non-shared anything all you like, as long  
> as you're not using TLS.

Except that the 'heap' internally uses TLS. The GC does need and use TLS.


More information about the Digitalmars-d mailing list