If stdout is __gshared, why does this throw / crash?
Marco Leise via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Mar 5 17:28:52 PST 2016
Got it now: https://issues.dlang.org/show_bug.cgi?id=15768
writeln() creates a copy of the stdout struct in a non
thread-safe way. If stdout has been assigned a File struct
created from a file name this copy includes a "racy"
increment/decrement of a reference count to the underlying
C-library FILE*. In the case that the reference count is
erroneously reaching 0, the file is closed prematurely and
when Glibc tries to access internal data it results in the
observable SIGSEGV.
--
Marco
More information about the Digitalmars-d-learn
mailing list