From 42eed2657f8e5c1d1af54a7394cef13467492b2e Mon Sep 17 00:00:00 2001 From: Jordan DeLong Date: Wed, 22 May 2013 14:23:51 -0700 Subject: [PATCH] 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 --- folly/Lazy.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/folly/Lazy.h b/folly/Lazy.h index 2b18ea7b..fd3e5103 100644 --- a/folly/Lazy.h +++ b/folly/Lazy.h @@ -35,8 +35,8 @@ namespace folly { * The value is created using folly::lazy, usually with a lambda, and * its value is requested using operator(). * - * Note that the value is not safe for current accesses by multiple - * threads, even if you declare it const. + * Note that the value is not safe for concurrent accesses by multiple + * threads, even if you declare it const. See note below. * * * Example Usage: @@ -70,6 +70,16 @@ namespace folly { * value unnecessarily. Sharing with mutable lazies would also * leave them with non-value semantics despite looking * 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. + * */ ////////////////////////////////////////////////////////////////////// -- 2.34.1