mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-17 12:44:42 +03:00
Restored cached_computation description
This commit is contained in:
@@ -13820,6 +13820,8 @@ However, over time, code fragments can turn up in unexpected places.
|
|||||||
return result;
|
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:
|
There are several ways that this example could be made safe for a multi-threaded environment:
|
||||||
|
|
||||||
* Delegate concurrency concerns upwards to the caller.
|
* Delegate concurrency concerns upwards to the caller.
|
||||||
|
|||||||
Reference in New Issue
Block a user