summaryrefslogtreecommitdiff
path: root/absl/base
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2018-10-23 12:23:49 -0700
committerGravatar Ashley Hedberg <ahedberg@google.com>2018-10-23 15:52:40 -0400
commit0884a6a04e4497d11b1b398cc0e422b118bf977a (patch)
tree05d1bb9fe31a4823bf8b0dba18703573a8757f7a /absl/base
parentc16d5557cd05119b5b7b1318ef778ebe3195b4a1 (diff)
Export of internal Abseil changes.
-- fe689b30f9a3a614e8a577997cc340043d01c2f1 by Abseil Team <absl-team@google.com>: Change arm32 linux backtrace to use the generic implementation. PiperOrigin-RevId: 218386158 -- 86f8678d055d32edc989e6a4d1dc49c3a15cd350 by Abseil Team <absl-team@google.com>: Update documentation on SHARED_LOCKS_REQUIRED and EXCLUSIVE_LOCKS_REQUIRED so that users know the differences between them. PiperOrigin-RevId: 218365545 -- 22947b48ce4a1ba71ad4794f762235dac3a1df12 by Greg Falcon <gfalcon@google.com>: The from_chars implementation incorrectly assumed `uint32_t` was `unsigned int`. `strings_internal::BigUnsigned` had `uint32_t` and `uint64_t` constructors; when both of these types differ from `unsigned int`, `BigUnsigned(1u)` is ambiguous (neither conversion is better). Fix this by removing the `uint32_t` constructor. When the `uint64_t` constructor is called with a literal or type that is 32 bits or narrower, the compiler is smart enough to optimize away the two-word case, so this fix is free. PiperOrigin-RevId: 218346935 -- 7201ab430bb90ca0e30b102915d02564f61353eb by Abseil Team <absl-team@google.com>: Fix formatting errors discovered during merge conflict. PiperOrigin-RevId: 218229891 GitOrigin-RevId: fe689b30f9a3a614e8a577997cc340043d01c2f1 Change-Id: I5d382482ad227d48ffe57b243ce11b1eb44a1314
Diffstat (limited to 'absl/base')
-rw-r--r--absl/base/thread_annotations.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/absl/base/thread_annotations.h b/absl/base/thread_annotations.h
index fbb2797b..2241ace4 100644
--- a/absl/base/thread_annotations.h
+++ b/absl/base/thread_annotations.h
@@ -108,13 +108,23 @@
// The mutex is expected to be held both on entry to, and exit from, the
// function.
//
+// An exclusive lock allows read-write access to the guarded data member(s), and
+// only one thread can acquire a lock exclusively at any one time. A shared lock
+// allows read-only access, and any number of threads can acquire a shared lock
+// concurrently.
+//
+// Generally, non-const methods should be annotated with
+// EXCLUSIVE_LOCKS_REQUIRED, while const methods should be annotated with
+// SHARED_LOCKS_REQUIRED.
+//
// Example:
//
// Mutex mu1, mu2;
// int a GUARDED_BY(mu1);
// int b GUARDED_BY(mu2);
//
-// void foo() EXCLUSIVE_LOCKS_REQUIRED(mu1, mu2) { ... };
+// void foo() EXCLUSIVE_LOCKS_REQUIRED(mu1, mu2) { ... }
+// void bar() const SHARED_LOCKS_REQUIRED(mu1, mu2) { ... }
#define EXCLUSIVE_LOCKS_REQUIRED(...) \
THREAD_ANNOTATION_ATTRIBUTE__(exclusive_locks_required(__VA_ARGS__))