5#ifndef RUNTIME_VM_LOCKERS_H_
6#define RUNTIME_VM_LOCKERS_H_
52 no_safepoint_scope_(
true),
58 if ((thread !=
nullptr) &&
62 no_safepoint_scope_ =
false;
71 if (no_safepoint_scope_) {
79 if (no_safepoint_scope_) {
88 if (no_safepoint_scope_) {
131 : monitor_(monitor), no_safepoint_scope_(no_safepoint_scope) {
132 ASSERT(monitor !=
nullptr);
134 if (no_safepoint_scope_) {
136 if (thread !=
nullptr) {
139 no_safepoint_scope_ =
false;
149 if (no_safepoint_scope_) {
157 if (no_safepoint_scope_) {
166 if (no_safepoint_scope_) {
173 return monitor_->Wait(millis);
181 return monitor_->WaitMicros(micros);
190 bool no_safepoint_scope_;
199 : monitor_locker_(monitor) {
200 monitor_locker_->
Exit();
286 locker_->ReleaseLock();
309 while (state_ == -1) {
315 MonitorLocker ml(&monitor_);
323 MonitorLocker ml(&monitor_);
324 while (state_ != 0) {
332 MonitorLocker ml(&monitor_);
366 bool TryEnterRead(
bool can_block,
bool* acquired_read_lock);
370 bool TryEnterWrite(
bool can_block);
407 rw_lock_->EnterRead();
423 ASSERT(rw_lock_ !=
nullptr);
424 if (!rw_lock_->EnterRead()) {
430 if (rw_lock_ !=
nullptr) {
431 rw_lock_->LeaveRead();
454 rw_lock_->EnterWrite();
471 rw_lock_->EnterWrite();
virtual ~MonitorLeaveScope()
MonitorLeaveScope(MonitorLocker *monitor)
Monitor::WaitResult WaitMicros(int64_t micros=Monitor::kNoTimeout)
Monitor::WaitResult WaitWithSafepointCheck(Thread *thread, int64_t millis=Monitor::kNoTimeout)
MonitorLocker(Monitor *monitor, bool no_safepoint_scope=true)
Monitor::WaitResult Wait(int64_t millis=Monitor::kNoTimeout)
static constexpr int64_t kNoTimeout
MutexLocker(Mutex *mutex)
static ThreadId GetCurrentThreadId()
static const ThreadId kInvalidThreadId
ReadRwLocker(ThreadState *thread_state, RwLock *rw_lock)
bool IsCurrentThreadWriter()
SafepointMonitorLocker(Monitor *monitor)
virtual ~SafepointMonitorLocker()
Monitor::WaitResult Wait(int64_t millis=Monitor::kNoTimeout)
SafepointMonitorUnlockScope(SafepointMonitorLocker *locker)
~SafepointMonitorUnlockScope()
virtual ~SafepointMutexLocker()
SafepointMutexLocker(Mutex *mutex)
SafepointReadRwLocker(ThreadState *thread_state, SafepointRwLock *rw_lock)
DEBUG_ONLY(bool IsCurrentThreadReader())
bool IsCurrentThreadWriter()
SafepointWriteRwLocker(ThreadState *thread_state, SafepointRwLock *rw_lock)
~SafepointWriteRwLocker()
ThreadState * thread() const
void DecrementNoSafepointScopeDepth()
static Thread * Current()
ExecutionState execution_state() const
void IncrementNoSafepointScopeDepth()
WriteRwLocker(ThreadState *thread_state, RwLock *rw_lock)
const bool kNoSafepointScope
const bool kDontAssertNoSafepointScope