Thread-local Member Variables?
Sean Kelly
sean at invisibleduck.org
Wed Jan 13 11:05:53 PST 2010
dsimcha Wrote:
> Should there be a way, in D, to create a variable that's local to both a
> thread and a class instance? For example:
>
> class Foo {
> __thread uint num;
> }
>
> num would basically be a reference to thread-local storage, with a new one
> created for every instance of Foo. Is there a (non-hacky) way to do this already?
I'd think that static member variables already work this way. I can't see this working for class instance variables though--the amount of storage required would vary based on the number of executing threads.
More information about the Digitalmars-d
mailing list