[Issue 18544] Thread-safety of "proto" GC before initialisation

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 1 16:31:19 UTC 2018


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

Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com

--- Comment #1 from Steven Schveighoffer <schveiguy at yahoo.com> ---
A thought on a potential fix: once you detect ranges being added/removed from
independent threads, then you initialize the GC.

You should be able to do this with an atomic read, and then CAS to a ProtoGC
instance variable that stores the "main thread" id.

The atomic read should be negligible compared to manipulating the roots/ranges
arrays.

--


More information about the Digitalmars-d-bugs mailing list