Commit 42eed265 authored by Jordan DeLong's avatar Jordan DeLong Committed by Sara Golemon

Some documentation updates in lazy

Summary: Per discussion after commit on the previous diff.

Test Plan: Compiled.

Reviewed By: tjackson@fb.com

FB internal diff: D821985
parent 12c8603d
...@@ -35,8 +35,8 @@ namespace folly { ...@@ -35,8 +35,8 @@ namespace folly {
* The value is created using folly::lazy, usually with a lambda, and * The value is created using folly::lazy, usually with a lambda, and
* its value is requested using operator(). * its value is requested using operator().
* *
* Note that the value is not safe for current accesses by multiple * Note that the value is not safe for concurrent accesses by multiple
* threads, even if you declare it const. * threads, even if you declare it const. See note below.
* *
* *
* Example Usage: * Example Usage:
...@@ -70,6 +70,16 @@ namespace folly { ...@@ -70,6 +70,16 @@ namespace folly {
* value unnecessarily. Sharing with mutable lazies would also * value unnecessarily. Sharing with mutable lazies would also
* leave them with non-value semantics despite looking * leave them with non-value semantics despite looking
* value-like. * value-like.
*
* - Not thread safe for const accesses. Many use cases for lazy
* values are local variables on the stack, where multiple
* threads shouldn't even be able to reach the value. It still
* is useful to indicate/check that the value doesn't change with
* const, particularly when it is captured by a large family of
* lambdas. Adding internal synchronization seems like it would
* pessimize the most common use case in favor of less likely use
* cases.
*
*/ */
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment