64 uint16_t node = universal_lock_id >> 48;
65 uint64_t offset = universal_lock_id & ((1ULL << 48) - 1ULL);
66 uintptr_t base =
reinterpret_cast<uintptr_t
>(resolver.
bases_[node]);
94 bool non_racy_acquire)
95 : lock_(lock), locked_by_me_(false) {
103 locked_by_me_ =
false;
109 if (non_racy_acquire) {
114 locked_by_me_ =
true;
123 locked_by_me_ =
false;
161 }
while (++cycles < timeout);
172 o <<
"<McsWwLock><locked>" << v.
is_locked() <<
"</locked><tail_waiter>"
174 <<
"</tail_block></McsWwLock>";
191 o <<
"<LockableXctId>" << v.
xct_id_ << v.
lock_ <<
"</LockableXctId>";
196 o <<
"<McsRwLock><locked>" << v.
is_locked() <<
"</locked><tail_waiter>"
198 <<
"</tail_block></McsRwLock>";
203 o <<
"<RwLockableXctId>" << v.
xct_id_ << v.
lock_ <<
"</RwLockableXctId>";
static void ownerless_release(McsWwLock *lock)
std::ostream & operator<<(std::ostream &o, const LockEntry &v)
Debugging.
void ownerless_initial_lock()
The followings are implemented in thread_pimpl.cpp along with the above methods, but these don't use ...
void ownerless_release_lock()
Page * to_page(const void *address)
super-dirty way to obtain Page the address belongs to.
bool timeout_granted(int32_t timeout)
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
thread::ThreadId get_tail_waiter() const __attribute__((always_inline))
This is a "relaxed" check.
Transaction ID, a 128-bit data to manage record versions and provide locking mechanism.
void hotter(thread::Thread *context) const
Represents one thread running on one NUMA core.
uint64_t spin_until(COND spin_until_cond)
Spin locally until the given condition returns true.
RwLockableXctId * from_universal_lock_id(const memory::GlobalVolatilePageResolver &resolver, const UniversalLockId universal_lock_id)
Always use this method rather than doing the conversion yourself.
bool pred_flag_is_granted()
Represents a pointer to a volatile page with modification count for preventing ABA.
static const int32_t kTimeoutZero
Persistent status part of Transaction ID.
void release()
Release the lock if acquired.
XctId xct_id_
the second 64bit: Persistent status part of TID.
uint32_t get_ordinal() const __attribute__((always_inline))
McsBlockIndex get_tail_waiter_block() const
McsRwLock lock_
the first 64bit: Locking part of TID
uintptr_t UniversalLockId
Universally ordered identifier of each lock.
The MCS reader-writer lock variant of LockableXctId.
static void ownerless_initial(McsWwLock *lock)
XctId xct_id_
the second 64bit: Persistent status part of TID.
UniversalLockId to_universal_lock_id(storage::VolatilePagePointer page_id, uintptr_t addr)
void increment(UniformRandom *rnd)
const uint64_t kLockPageSize
Must be same as storage::kPageSize.
memory::PagePoolOffset get_offset() const
Definitions of IDs in this package and a few related constant values.
An exclusive-only (WW) MCS lock data structure.
void acquire(bool non_racy_acquire)
Acquires the lock.
bool timeout_granted(int32_t timeout)
MCS block classes.
void assert_within_valid_volatile_page(const memory::GlobalVolatilePageResolver &resolver, const void *address)
bool is_locked_by_me() const
Epoch get_epoch() const __attribute__((always_inline))
bool is_next_layer() const __attribute__((always_inline))
Just a marker to denote that the memory region represents a data page.
bool is_deleted() const __attribute__((always_inline))
static const int32_t kTimeoutNever
bool is_locked() const
This is a "relaxed" check.
VolatilePagePointer construct_volatile_page_pointer(uint64_t word)
static const int32_t kTimeoutNever
assorted::UniformRandom & get_lock_rnd()
bool is_being_written() const __attribute__((always_inline))
PageHeader & get_header()
At least the basic header exists in all pages.
McsBlockIndex get_tail_waiter_block() const __attribute__((always_inline))
This is a "relaxed" check.
void ownerless_acquire_lock()
void yield_if_valgrind()
Use this in your while as a stop-gap before switching to spin_until().
bool is_moved() const __attribute__((always_inline))
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
uint8_t get_numa_node() const
McsWwLock lock_
the first 64bit: Locking part of TID
Raw atomic operations that work for both C++11 and non-C++11 code.
bool is_hot(thread::Thread *context) const
static void ownerless_acquire_unconditional(McsWwLock *lock)
[WW-Guest] Unconditionally takes exclusive-only guest lock on the given MCSg lock.
const uint16_t kPageSize
A constant defining the page size (in bytes) of both snapshot pages and volatile pages.
An MCS reader-writer lock data structure.
thread::ThreadId get_tail_waiter() const