libfoedus-core
FOEDUS Core Library
foedus::xct::McsOwnerlessLockScope Class Reference

Detailed Description

Definition at line 1157 of file xct_id.hpp.

#include <xct_id.hpp>

Public Member Functions

 McsOwnerlessLockScope ()
 
 McsOwnerlessLockScope (McsWwLock *lock, bool acquire_now=true, bool non_racy_acquire=false)
 
 ~McsOwnerlessLockScope ()
 
bool is_valid () const
 
bool is_locked_by_me () const
 
void acquire (bool non_racy_acquire)
 Acquires the lock. More...
 
void release ()
 Release the lock if acquired. More...
 

Constructor & Destructor Documentation

foedus::xct::McsOwnerlessLockScope::McsOwnerlessLockScope ( )

Definition at line 90 of file xct_id.cpp.

90 : lock_(nullptr), locked_by_me_(false) {}
foedus::xct::McsOwnerlessLockScope::McsOwnerlessLockScope ( McsWwLock lock,
bool  acquire_now = true,
bool  non_racy_acquire = false 
)

Definition at line 91 of file xct_id.cpp.

References acquire().

95  : lock_(lock), locked_by_me_(false) {
96  if (acquire_now) {
97  acquire(non_racy_acquire);
98  }
99 }
void acquire(bool non_racy_acquire)
Acquires the lock.
Definition: xct_id.cpp:106

Here is the call graph for this function:

foedus::xct::McsOwnerlessLockScope::~McsOwnerlessLockScope ( )

Definition at line 100 of file xct_id.cpp.

References release().

100  {
101  release();
102  lock_ = nullptr;
103  locked_by_me_ = false;
104 }
void release()
Release the lock if acquired.
Definition: xct_id.cpp:119

Here is the call graph for this function:

Member Function Documentation

void foedus::xct::McsOwnerlessLockScope::acquire ( bool  non_racy_acquire)

Acquires the lock.

Does nothing if already acquired or !is_valid().

Definition at line 106 of file xct_id.cpp.

References is_locked_by_me(), is_valid(), foedus::xct::McsWwLock::ownerless_acquire_lock(), and foedus::xct::McsWwLock::ownerless_initial_lock().

Referenced by McsOwnerlessLockScope().

106  {
107  if (is_valid()) {
108  if (!is_locked_by_me()) {
109  if (non_racy_acquire) {
110  lock_->ownerless_initial_lock();
111  } else {
112  lock_->ownerless_acquire_lock();
113  }
114  locked_by_me_ = true;
115  }
116  }
117 }
void ownerless_initial_lock()
The followings are implemented in thread_pimpl.cpp along with the above methods, but these don't use ...
Definition: xct_id.cpp:86
void ownerless_acquire_lock()
Definition: xct_id.cpp:78

Here is the call graph for this function:

Here is the caller graph for this function:

bool foedus::xct::McsOwnerlessLockScope::is_locked_by_me ( ) const
inline

Definition at line 1167 of file xct_id.hpp.

Referenced by acquire(), and release().

1167 { return locked_by_me_; }

Here is the caller graph for this function:

bool foedus::xct::McsOwnerlessLockScope::is_valid ( ) const
inline

Definition at line 1166 of file xct_id.hpp.

Referenced by acquire(), and release().

1166 { return lock_; }

Here is the caller graph for this function:

void foedus::xct::McsOwnerlessLockScope::release ( )

Release the lock if acquired.

Does nothing if not or !is_valid().

Definition at line 119 of file xct_id.cpp.

References is_locked_by_me(), is_valid(), and foedus::xct::McsWwLock::ownerless_release_lock().

Referenced by ~McsOwnerlessLockScope().

119  {
120  if (is_valid()) {
121  if (is_locked_by_me()) {
122  lock_->ownerless_release_lock();
123  locked_by_me_ = false;
124  }
125  }
126 }
void ownerless_release_lock()
Definition: xct_id.cpp:82

Here is the call graph for this function:

Here is the caller graph for this function:


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