Threads and static initialization.
Michel Fortin
michel.fortin at michelf.com
Fri Dec 17 16:02:27 PST 2010
On 2010-12-17 16:47:05 -0500, wrzosk <dprogr at gmail.com> said:
> I believe that when new thread is being created, all static data is
> initialized inside new thread. What worries me is the fact, that many
> 'mini' threads will initialize all static data inside application. This
> may be somewhat time consuming.
> Maybe there should be a possibility to define 'Pure' thread that doesnt
> touch any static data, and in turn it could leave static constructors
> untouched.
>
> What do you think
You mean something like this:
pure void doSomething(Tid parent) {
int result = 1 + 1;
parent.sendMessage(result);
}
void main() {
spawn(&doSomething);
... wait for message ...
}
Perhaps 'spawn' could do this when you feed it with a pure function.
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list