summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build/Android.bp2
-rw-r--r--runtime/openjdkjvmti/ti_monitor.cc6
2 files changed, 5 insertions, 3 deletions
diff --git a/build/Android.bp b/build/Android.bp
index cd9d74a934..b1553c759c 100644
--- a/build/Android.bp
+++ b/build/Android.bp
@@ -70,6 +70,8 @@ art_global_defaults {
"-DART_STACK_OVERFLOW_GAP_mips64=16384",
"-DART_STACK_OVERFLOW_GAP_x86=8192",
"-DART_STACK_OVERFLOW_GAP_x86_64=8192",
+ // Enable thread annotations for std::mutex, etc.
+ "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS",
],
target: {
diff --git a/runtime/openjdkjvmti/ti_monitor.cc b/runtime/openjdkjvmti/ti_monitor.cc
index b82768397b..645faea41b 100644
--- a/runtime/openjdkjvmti/ti_monitor.cc
+++ b/runtime/openjdkjvmti/ti_monitor.cc
@@ -54,7 +54,7 @@ class JvmtiMonitor {
JvmtiMonitor() : owner_(nullptr), count_(0) {
}
- static bool Destroy(art::Thread* self, JvmtiMonitor* monitor) {
+ static bool Destroy(art::Thread* self, JvmtiMonitor* monitor) NO_THREAD_SAFETY_ANALYSIS {
// Check whether this thread holds the monitor, or nobody does.
art::Thread* owner_thread = monitor->owner_.load(std::memory_order_relaxed);
if (owner_thread != nullptr && self != owner_thread) {
@@ -71,7 +71,7 @@ class JvmtiMonitor {
return true;
}
- void MonitorEnter(art::Thread* self) {
+ void MonitorEnter(art::Thread* self) NO_THREAD_SAFETY_ANALYSIS {
// Check for recursive enter.
if (IsOwner(self)) {
count_++;
@@ -86,7 +86,7 @@ class JvmtiMonitor {
count_ = 1;
}
- bool MonitorExit(art::Thread* self) {
+ bool MonitorExit(art::Thread* self) NO_THREAD_SAFETY_ANALYSIS {
if (!IsOwner(self)) {
return false;
}