Use static thread safety analysis when available, and fix the bugs GCC finds.
It's impossible to express the Heap locking and the ThreadList locking with
GCC, but Clang is supposed to be able to do it. This patch does what's possible
for now.
Change-Id: Ib64a890c9d27c6ce255d5003cb755c2ef1beba95
diff --git a/src/monitor.h b/src/monitor.h
index b949921..e5aa01e 100644
--- a/src/monitor.h
+++ b/src/monitor.h
@@ -91,13 +91,13 @@
static void FailedUnlock(Object* obj, Thread* expected_owner, Thread* found_owner, Monitor* mon);
- void Lock(Thread* self);
- bool Unlock(Thread* thread);
+ void Lock(Thread* self) NO_THREAD_SAFETY_ANALYSIS; // TODO: mark Object LOCKABLE.
+ bool Unlock(Thread* thread) NO_THREAD_SAFETY_ANALYSIS; // TODO: mark Object LOCKABLE.
void Notify(Thread* self);
void NotifyAll(Thread* self);
- void Wait(Thread* self, int64_t msec, int32_t nsec, bool interruptShouldThrow);
+ void Wait(Thread* self, int64_t msec, int32_t nsec, bool interruptShouldThrow) NO_THREAD_SAFETY_ANALYSIS; // TODO: mark Object LOCKABLE.
// Translates the provided method and pc into its declaring class' source file and line number.
void TranslateLocation(const Method* method, uint32_t pc,