Zero  0.1.0
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
lock_queue_entry_t Class Reference

A lock request entry in a lock queue. More...

#include <lock_bucket.h>

Public Member Functions

uint32_t get_observed_release_version () const
 
const okvl_modeget_requested_mode () const
 
const okvl_modeget_granted_mode () const
 

Private Member Functions

 lock_queue_entry_t (xct_t &xct, smthread_t &thr, xct_lock_info_t &li, const okvl_mode &granted_mode, const okvl_mode &requested_mode)
 

Private Attributes

xct_t_xct
 owning xct. More...
 
smthread_t_thr
 owning thread. More...
 
xct_lock_info_t_li
 
xct_lock_entry_t_xct_entry
 
lock_queue_entry_t_prev
 
lock_queue_entry_t_next
 
uint64_t _observed_release_version
 
okvl_mode _granted_mode
 
okvl_mode _requested_mode
 

Friends

class lock_queue_t
 
class lock_core_m
 
ostream & operator<< (ostream &o, const lock_queue_entry_t &r)
 

Detailed Description

A lock request entry in a lock queue.

All fields except _prev and _next, which are protected by L in the usual way, of this class have unusual access protections:

For any thread but this->_thr:

read a field: must have read access to L write a field: forbidden

For the thread this->_thr:

read a field: always legal write a field: must have write access to L

where L is the _requests_latch latch of the lock_queue_t we belong to if any. It is believed that this provides complete protection (e.g., no stale reads).

The primary reason for these relaxed rules is to allow release_duration to avoid needing to find and take L in read mode just to see if a lock needs to be released.

Constructor & Destructor Documentation

§ lock_queue_entry_t()

lock_queue_entry_t::lock_queue_entry_t ( xct_t xct,
smthread_t thr,
xct_lock_info_t li,
const okvl_mode granted_mode,
const okvl_mode requested_mode 
)
inlineprivate

Member Function Documentation

§ get_granted_mode()

const okvl_mode& lock_queue_entry_t::get_granted_mode ( ) const
inline

§ get_observed_release_version()

uint32_t lock_queue_entry_t::get_observed_release_version ( ) const
inline

§ get_requested_mode()

const okvl_mode& lock_queue_entry_t::get_requested_mode ( ) const
inline

Friends And Related Function Documentation

§ lock_core_m

friend class lock_core_m
friend

§ lock_queue_t

friend class lock_queue_t
friend

§ operator<<

ostream& operator<< ( ostream &  o,
const lock_queue_entry_t r 
)
friend

Requires holding a read latch for queue._requests_latch where queue is the lock_queue_t that r belongs to.

Member Data Documentation

§ _granted_mode

okvl_mode lock_queue_entry_t::_granted_mode
private

§ _li

xct_lock_info_t& lock_queue_entry_t::_li
private

§ _next

lock_queue_entry_t* lock_queue_entry_t::_next
private

§ _observed_release_version

uint64_t lock_queue_entry_t::_observed_release_version
private

The _release_version of the lock queue when this lock's _wait_map is last updated. When we check deadlocks, we tentatively ignore other lock requests whose observed_release_version is older than _release_version of the lock queue to prevent false detections. 0 if this lock is not waiting. This is NOT protected by latch because this is used only opportunistically.

§ _prev

lock_queue_entry_t* lock_queue_entry_t::_prev
private

§ _requested_mode

okvl_mode lock_queue_entry_t::_requested_mode
private

§ _thr

smthread_t& lock_queue_entry_t::_thr
private

owning thread.

§ _xct

xct_t& lock_queue_entry_t::_xct
private

owning xct.

§ _xct_entry

xct_lock_entry_t* lock_queue_entry_t::_xct_entry
private

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