D create many thread

Steven Schveighoffer schveiguy at gmail.com
Fri Feb 7 15:52:40 UTC 2020


On 2/7/20 2:34 AM, bauss wrote:
> On Thursday, 6 February 2020 at 22:00:26 UTC, tchaloupka wrote:
>> On Wednesday, 5 February 2020 at 13:05:59 UTC, Eko Wahyudin wrote:
>>> Hi all,
>>>
>>> I'm create a small (hallo world) application, with DMD.
>>> But my program create 7 annoying threads when create an empty class.
>>>
>>
>> If you don't want the parallel sweep enabled for your app, you can 
>> turn it of ie with:
>>
>> ```
>> extern(C) __gshared string[] rt_options = [ "gcopt=parallel:0" ];
>> ```
>>
>> Or in various other ways as described in mentioned documentation: 
>> https://dlang.org/spec/garbage.html#gc_config
> 
> Why are we doing it like that? That's the least user-friendly method of 
> configuring the GC I have ever seen.

The reason this has to be configured this way is because the parallel 
scanning is an implementation detail, and shouldn't be exposed via the 
core.memory.GC interface.

But I still maintain, a hello world program should not need this to 
avoid spawning 6 threads to scan itself.

-Steve


More information about the Digitalmars-d-learn mailing list