Implement mutex requeueing for cv broadcasts.
Make the mutex guarding a condition variable part of its state. On a
broadcast requeue waiters on the mutex so they are awoken as the mutex
is unlocked (thereby avoiding thundering herds). Explicit futex use
still guarded behind ART_USE_FUTEXES which remains disabled as I'm
unhappy with some of the warts of mutex usage. Uploading so that the API
changes can stabilize.
Change-Id: Iedb601856ccd8bbc3a64da4ba0cee82246e7bcbf
diff --git a/src/debugger.h b/src/debugger.h
index c577590..f9d00d1 100644
--- a/src/debugger.h
+++ b/src/debugger.h
@@ -43,7 +43,7 @@
arg_count_(0), arg_values_(NULL), options_(0), error(JDWP::ERR_NONE),
result_tag(JDWP::JT_VOID), exception(0),
lock_("a DebugInvokeReq lock"),
- cond_("a DebugInvokeReq condition variable") {
+ cond_("a DebugInvokeReq condition variable", lock_) {
}
/* boolean; only set when we're in the tail end of an event handler */
@@ -68,8 +68,8 @@
JDWP::ObjectId exception;
/* condition variable to wait on while the method executes */
- Mutex lock_;
- ConditionVariable cond_;
+ Mutex lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
+ ConditionVariable cond_ GUARDED_BY(lock_);
};
class Dbg {