[Issue 18714] New: Phobos calls localtime, which is not threadsafe
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Apr 3 07:50:15 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18714
Issue ID: 18714
Summary: Phobos calls localtime, which is not threadsafe
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: enhancement
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: default_357-line at yahoo.de
To implement timezone handling, std.datetime.timezone calls localtime.
localtime returns a pointer to a global shared struct. This means that
subsequent calls to localtime in a second thread may overwrite the data of the
first thread before the first thread can read it, causing corruption. This can
be seen by calling localtime on two different arguments in a loop, in two
threads, and validating the result.
--
More information about the Digitalmars-d-bugs
mailing list