Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dart::SafepointMutexLocker Class Reference

#include <lockers.h>

Inheritance diagram for dart::SafepointMutexLocker:
dart::StackResource

Public Member Functions

 SafepointMutexLocker (Mutex *mutex)
 
 SafepointMutexLocker (ThreadState *thread, Mutex *mutex)
 
virtual ~SafepointMutexLocker ()
 
- Public Member Functions inherited from dart::StackResource
 StackResource (ThreadState *thread)
 
virtual ~StackResource ()
 
ThreadStatethread () const
 

Additional Inherited Members

- Static Public Member Functions inherited from dart::StackResource
static void Unwind (ThreadState *thread)
 
static void UnwindAbove (ThreadState *thread, StackResource *new_top)
 

Detailed Description

Definition at line 229 of file lockers.h.

Constructor & Destructor Documentation

◆ SafepointMutexLocker() [1/2]

dart::SafepointMutexLocker::SafepointMutexLocker ( Mutex mutex)
inlineexplicit

Definition at line 231 of file lockers.h.

SafepointMutexLocker(Mutex *mutex)
Definition lockers.h:231
static ThreadState * Current()

◆ SafepointMutexLocker() [2/2]

dart::SafepointMutexLocker::SafepointMutexLocker ( ThreadState thread,
Mutex mutex 
)

Definition at line 42 of file lockers.cc.

43 : StackResource(thread), mutex_(mutex) {
44 ASSERT(mutex != nullptr);
45 if (!mutex_->TryLock()) {
46 // We did not get the lock and could potentially block, so transition
47 // accordingly.
48 Thread* thread = Thread::Current();
49 if (thread != nullptr) {
50 TransitionVMToBlocked transition(thread);
51 mutex->Lock();
52 } else {
53 mutex->Lock();
54 }
55 }
56}
ThreadState * thread() const
Definition allocation.h:33
StackResource(ThreadState *thread)
Definition allocation.h:25
static Thread * Current()
Definition thread.h:361
#define ASSERT(E)

◆ ~SafepointMutexLocker()

virtual dart::SafepointMutexLocker::~SafepointMutexLocker ( )
inlinevirtual

Definition at line 234 of file lockers.h.

234{ mutex_->Unlock(); }

The documentation for this class was generated from the following files: