Order of Static Construction
Steven Schveighoffer
schveiguy at gmail.com
Mon Jan 7 22:03:49 UTC 2019
On 1/7/19 5:02 PM, Steven Schveighoffer wrote:
> On 1/5/19 10:22 AM, Dru wrote:
>> Construction order is resolved by module dependencies (import statements)
>>
>> In the main thread
>> ----------------------
>> Currently, shared and thread-local construction are separated.
>>
>> Instead we could "construct a module", i.e run both shared and
>> thread-local construction for that module, then continue to construct
>> the next module.
>
> This is a really good idea, actually. I hadn't thought of that approach
> at all. I think it can be done in druntime as well, without depending on
> compiler changes.
>
> I will post an enhancement request to track it. Thanks!
Note that this still doesn't solve the current problem of a thread
running static ctors before the main thread's shared static ctors are
done. We should deal with that as well.
-Steve
More information about the Digitalmars-d
mailing list