Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1064)

Side by Side Diff: mojo/edk/util/thread_annotations.h

Issue 1426343002: EDK: Move mutex.*, cond_var.*, and thread_annotations.h to //mojo/edk/util. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: oops Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/edk/util/mutex_unittest.cc ('k') | mojo/edk/util/thread_annotations_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Macros for static thread-safety analysis. 5 // Macros for static thread-safety analysis.
6 // 6 //
7 // These are from http://clang.llvm.org/docs/ThreadSafetyAnalysis.html (and thus 7 // These are from http://clang.llvm.org/docs/ThreadSafetyAnalysis.html (and thus
8 // really derive from google3's thread_annotations.h). 8 // really derive from google3's thread_annotations.h).
9 // 9 //
10 // TODO(vtl): We're still using the old-fashioned, deprecated annotations 10 // TODO(vtl): We're still using the old-fashioned, deprecated annotations
11 // ("locks" instead of "capabilities"), since the new ones don't work yet (in 11 // ("locks" instead of "capabilities"), since the new ones don't work yet (in
12 // particular, |TRY_ACQUIRE()| doesn't work: b/19264527). 12 // particular, |TRY_ACQUIRE()| doesn't work: b/19264527).
13 // https://github.com/domokit/mojo/issues/314 13 // https://github.com/domokit/mojo/issues/314
14 14
15 #ifndef MOJO_EDK_SYSTEM_THREAD_ANNOTATIONS_H_ 15 #ifndef MOJO_EDK_UTIL_THREAD_ANNOTATIONS_H_
16 #define MOJO_EDK_SYSTEM_THREAD_ANNOTATIONS_H_ 16 #define MOJO_EDK_UTIL_THREAD_ANNOTATIONS_H_
17 17
18 // Enable thread-safety attributes only with clang. 18 // Enable thread-safety attributes only with clang.
19 // The attributes can be safely erased when compiling with other compilers. 19 // The attributes can be safely erased when compiling with other compilers.
20 #if defined(__clang__) 20 #if defined(__clang__)
21 #define MOJO_THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x)) 21 #define MOJO_THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x))
22 #else 22 #else
23 #define MOJO_THREAD_ANNOTATION_ATTRIBUTE__(x) 23 #define MOJO_THREAD_ANNOTATION_ATTRIBUTE__(x)
24 #endif 24 #endif
25 25
26 #define MOJO_GUARDED_BY(x) MOJO_THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x)) 26 #define MOJO_GUARDED_BY(x) MOJO_THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x))
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 MOJO_THREAD_ANNOTATION_ATTRIBUTE__(no_thread_safety_analysis) 75 MOJO_THREAD_ANNOTATION_ATTRIBUTE__(no_thread_safety_analysis)
76 76
77 // Use this in the header to annotate a function/method as not being 77 // Use this in the header to annotate a function/method as not being
78 // thread-safe. This is equivalent to |MOJO_NO_THREAD_SAFETY_ANALYSIS|, but 78 // thread-safe. This is equivalent to |MOJO_NO_THREAD_SAFETY_ANALYSIS|, but
79 // semantically different: it declares that the caller must abide by additional 79 // semantically different: it declares that the caller must abide by additional
80 // restrictions. Limitation: Unfortunately, you can't apply this to a method in 80 // restrictions. Limitation: Unfortunately, you can't apply this to a method in
81 // an interface (i.e., pure virtual method) and have it applied automatically to 81 // an interface (i.e., pure virtual method) and have it applied automatically to
82 // implementations. 82 // implementations.
83 #define MOJO_NOT_THREAD_SAFE MOJO_NO_THREAD_SAFETY_ANALYSIS 83 #define MOJO_NOT_THREAD_SAFE MOJO_NO_THREAD_SAFETY_ANALYSIS
84 84
85 #endif // MOJO_EDK_SYSTEM_THREAD_ANNOTATIONS_H_ 85 #endif // MOJO_EDK_UTIL_THREAD_ANNOTATIONS_H_
OLDNEW
« no previous file with comments | « mojo/edk/util/mutex_unittest.cc ('k') | mojo/edk/util/thread_annotations_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698