From 7d7ce4a5ebaca7155e754b1bf7b45366e87d0194 Mon Sep 17 00:00:00 2001 From: Robert burner Schadek Date: Sun, 7 May 2017 10:54:53 +0200 Subject: [PATCH] Logger sharedLog comment on thread-safety fix Issue 16232 - std.experimental.logger.core.sharedLog isn't thread-safe --- std/experimental/logger/core.d | 3 +++ 1 file changed, 3 insertions(+) diff --git a/std/experimental/logger/core.d b/std/experimental/logger/core.d index 22ba7d25283..e8e8d4c0531 100644 --- a/std/experimental/logger/core.d +++ b/std/experimental/logger/core.d @@ -1661,6 +1661,9 @@ While getting and setting $(D sharedLog) is thread-safe, it has to be considered that the returned reference is only a current snapshot and in the following code, you must make sure no other thread reassigns to it between reading and writing $(D sharedLog). + +$(D sharedLog) is only thread-safe if the the used $(D Logger) is thread-safe. +The default $(D Logger) is thread-safe. ------------- if (sharedLog !is myLogger) sharedLog = new myLogger;