A better way to check if the gc is running

Steven Schveighoffer schveiguy at yahoo.com
Sun Dec 15 22:33:58 UTC 2019


On Thursday, 12 December 2019 at 09:00:38 UTC, Petar Kirov 
[ZombineDev] wrote:
> On Thursday, 12 December 2019 at 08:56:37 UTC, bogdan wrote:
>> Hi,
>>
>> When combining ref counting and GC allocated classes, weird 
>> bugs might happen. Is it possible to add a new member in 
>> `core.memory.GC`, like `isCollecting` or `isRunning`, to avoid 
>> testing if the GC is running, without allocating like this?
>>
>> https://p0nce.github.io/d-idioms/#GC-proof-resource-class
>>
>>
>
> I agree that this is a good idea. It shouldn't be hard to 
> implement as the GC implementation already has this information 
> available, so it's just a matter of exposing it through the 
> layers.

https://issues.dlang.org/show_bug.cgi?id=17563

-Steve


More information about the Digitalmars-d mailing list