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

#include <lockers.h>

Inheritance diagram for dart::MutexLocker:
dart::ValueObject

Public Member Functions

 MutexLocker (Mutex *mutex)
 
virtual ~MutexLocker ()
 
void Lock () const
 
void Unlock () const
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Detailed Description

Definition at line 47 of file lockers.h.

Constructor & Destructor Documentation

◆ MutexLocker()

dart::MutexLocker::MutexLocker ( Mutex mutex)
inlineexplicit

Definition at line 49 of file lockers.h.

50 :
51#if defined(DEBUG)
52 no_safepoint_scope_(true),
53#endif
54 mutex_(mutex) {
55 ASSERT(mutex != nullptr);
56#if defined(DEBUG)
57 Thread* thread = Thread::Current();
58 if ((thread != nullptr) &&
59 (thread->execution_state() != Thread::kThreadInNative)) {
60 thread->IncrementNoSafepointScopeDepth();
61 } else {
62 no_safepoint_scope_ = false;
63 }
64#endif
65 mutex_->Lock();
66 }
static Thread * Current()
Definition thread.h:361
@ kThreadInNative
Definition thread.h:1023
#define ASSERT(E)

◆ ~MutexLocker()

virtual dart::MutexLocker::~MutexLocker ( )
inlinevirtual

Definition at line 68 of file lockers.h.

68 {
69 mutex_->Unlock();
70#if defined(DEBUG)
71 if (no_safepoint_scope_) {
73 }
74#endif
75 }
void DecrementNoSafepointScopeDepth()
Definition thread.h:720

Member Function Documentation

◆ Lock()

void dart::MutexLocker::Lock ( ) const
inline

Definition at line 77 of file lockers.h.

77 {
78#if defined(DEBUG)
79 if (no_safepoint_scope_) {
81 }
82#endif
83 mutex_->Lock();
84 }
void IncrementNoSafepointScopeDepth()
Definition thread.h:713

◆ Unlock()

void dart::MutexLocker::Unlock ( ) const
inline

Definition at line 85 of file lockers.h.

85 {
86 mutex_->Unlock();
87#if defined(DEBUG)
88 if (no_safepoint_scope_) {
90 }
91#endif
92 }

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