From 959b556aac8c331e8857a5813aa8a1e3f39a0ba5 Mon Sep 17 00:00:00 2001 From: hsutter Date: Thu, 2 May 2019 11:06:03 -0700 Subject: [PATCH] Restored cached_computation description --- CppCoreGuidelines.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index 5b57554..0091ecd 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -13820,6 +13820,8 @@ However, over time, code fragments can turn up in unexpected places. return result; } +Although `cached_computation` works perfectly in a single-threaded environment, in a multi-threaded environment the two `static` variables result in data races and thus undefined behavior. + There are several ways that this example could be made safe for a multi-threaded environment: * Delegate concurrency concerns upwards to the caller.