Wrt. threadlocal by default: shared module constructors

downs default_357-line at yahoo.de
Wed May 13 05:50:25 PDT 2009


So .. how will the threadlocal global variables be initialized?

Obviously, they can't be initialized in the static constructor, since that is only run once.

But if the static constructors are run on every new thread, what about the shared variables that only need to be initialized once?

For these reasons, I propose two changes:

1) Module constructors are run at thread creation

2) the introduction of _shared module constructors_, who are run before module constructors, at program startup, to initialize the global shared variables.

I don't see any other way to handle these issues.

Feedback appreciated.



More information about the Digitalmars-d mailing list