Threads and static initialization.

Jonathan M Davis jmdavisProg at gmx.com
Fri Dec 17 17:06:26 PST 2010


On Friday 17 December 2010 16:44:19 Vladimir Panteleev wrote:
> On Sat, 18 Dec 2010 01:27:01 +0200, Jonathan M Davis <jmdavisProg at gmx.com>
> 
> wrote:
> > Except that virtually _everything_ in D is in TLS. Only shared variables
> > and
> > some immutable variables aren't. So, unless you use a set of functions
> > which
> > uses shared variables for _everything_, that would be rather useless.
> 
> But isn't that what OP's asking?
> 
> Also, I wouldn't say it's useless... By _everything_ you mean global and
> class/function static variables, right? I can imagine lots of examples of
> using threads without having to access those variables.

And how about every other variable? If it's not shared or immutable, it's in 
TLS. Do you want to mark every single variable with shared? I believe that 
that's pretty much what you'd have to do. It's _rare_ in D that a variable is 
shared. You'd basically have to create a set of functions explictly intended to 
be used with such special threads.

- Jonathan M Davis


More information about the Digitalmars-d mailing list