libfoedus-core
FOEDUS Core Library
foedus::xct::McsAdaptorConcept< RW_BLOCK > Class Template Reference

Defines an adapter template interface for our MCS lock classes. More...

Detailed Description

template<typename RW_BLOCK>
class foedus::xct::McsAdaptorConcept< RW_BLOCK >

Defines an adapter template interface for our MCS lock classes.

This object is NOT used by itself at all. Rather, this just defines the interface a template object must meet for our MCS lock classes. In other words, this is something like template-concept. Hey, but it's yet to come in standard..

No virtual method, no inheritance. This is a template interface that inlines everything. We can't afford virtual function calls for every single MCS lock. In release compilation, all traces of these objects should disappear.

ww/rw
In some methods, we have prefix ww (write-write or exclusive) or rw (reader-writer). This is because we currently keep both the original MCSg lock and a reader-writer version in the code. Once we integrate everything to rw, we might eliminate the ww versions.
Template Parameters
RW_BLOCKQueue node object for RW-lock. Either McsRwSimpleBlock or McsRwExtendedBlock.

Definition at line 57 of file xct_mcs_adapter_impl.hpp.

#include <xct_mcs_adapter_impl.hpp>

Public Types

typedef RW_BLOCK ThisRwBlock
 ThisRwBlock shall indicate the block type. More...
 

Public Member Functions

McsBlockIndex issue_new_block ()
 Issues a new queue node of this thread and returns its block index. More...
 
void cancel_new_block (McsBlockIndex the_block)
 Cancels the most recent issue_new_block() call, decrementing the counter. More...
 
McsBlockIndex get_cur_block () const
 
McsBlockIndex get_other_cur_block (thread::ThreadId id)
 
thread::ThreadId get_my_id () const
 Returns thread-Id of this thread. More...
 
thread::ThreadGroupId get_my_numa_node () const
 Returns group-Id of this thread. More...
 
std::atomic< bool > * me_waiting ()
 Returns the atomic bool var on whether current thread is waiting for some lock. More...
 
std::atomic< bool > * other_waiting (thread::ThreadId id)
 Returns the bool var on whether other thread is waiting for some lock. More...
 
McsWwBlockget_ww_my_block (McsBlockIndex index)
 Dereference my block index for exclusive locks. More...
 
RW_BLOCK * get_rw_my_block (McsBlockIndex index)
 Dereference my block index for reader-writer locks. More...
 
McsWwBlockget_ww_other_block (thread::ThreadId id, McsBlockIndex index)
 Dereference other thread's block index for exclusive locks. More...
 
RW_BLOCK * get_rw_other_block (thread::ThreadId id, McsBlockIndex index)
 Dereference other thread's block index for reader-writer locks. More...
 
RW_BLOCK * get_rw_other_block (uint32_t block_int)
 Dereference other thread's block index for reader-writer locks, but receives a block int. More...
 
RW_BLOCK * dereference_rw_tail_block (uint32_t tail_int)
 same as above, but receives a combined int in For McsRwLock More...
 
McsRwExtendedBlockget_rw_other_async_block (thread::ThreadId id, xct::McsRwLock *lock)
 Dereference other thread's block index for extended rwlock. More...
 
void add_rw_async_mapping (xct::McsRwLock *lock, xct::McsBlockIndex block_index)
 

Member Typedef Documentation

template<typename RW_BLOCK >
typedef RW_BLOCK foedus::xct::McsAdaptorConcept< RW_BLOCK >::ThisRwBlock

ThisRwBlock shall indicate the block type.

Definition at line 60 of file xct_mcs_adapter_impl.hpp.

Member Function Documentation

template<typename RW_BLOCK >
void foedus::xct::McsAdaptorConcept< RW_BLOCK >::add_rw_async_mapping ( xct::McsRwLock lock,
xct::McsBlockIndex  block_index 
)
template<typename RW_BLOCK >
void foedus::xct::McsAdaptorConcept< RW_BLOCK >::cancel_new_block ( McsBlockIndex  the_block)

Cancels the most recent issue_new_block() call, decrementing the counter.

Use this method carefully. You can call this method only when the issued block has no chance to be observed by other threads. For example, this is used when a "try" lock fails. The parameter is used only for sanity check assertion.

template<typename RW_BLOCK >
RW_BLOCK* foedus::xct::McsAdaptorConcept< RW_BLOCK >::dereference_rw_tail_block ( uint32_t  tail_int)

same as above, but receives a combined int in For McsRwLock

template<typename RW_BLOCK >
McsBlockIndex foedus::xct::McsAdaptorConcept< RW_BLOCK >::get_cur_block ( ) const
template<typename RW_BLOCK >
thread::ThreadId foedus::xct::McsAdaptorConcept< RW_BLOCK >::get_my_id ( ) const

Returns thread-Id of this thread.

template<typename RW_BLOCK >
thread::ThreadGroupId foedus::xct::McsAdaptorConcept< RW_BLOCK >::get_my_numa_node ( ) const

Returns group-Id of this thread.

template<typename RW_BLOCK >
McsBlockIndex foedus::xct::McsAdaptorConcept< RW_BLOCK >::get_other_cur_block ( thread::ThreadId  id)
template<typename RW_BLOCK >
RW_BLOCK* foedus::xct::McsAdaptorConcept< RW_BLOCK >::get_rw_my_block ( McsBlockIndex  index)

Dereference my block index for reader-writer locks.

template<typename RW_BLOCK >
McsRwExtendedBlock* foedus::xct::McsAdaptorConcept< RW_BLOCK >::get_rw_other_async_block ( thread::ThreadId  id,
xct::McsRwLock lock 
)

Dereference other thread's block index for extended rwlock.

This will go over the TLS lock-block_index mapping to find out the block index. For writers only.

template<typename RW_BLOCK >
RW_BLOCK* foedus::xct::McsAdaptorConcept< RW_BLOCK >::get_rw_other_block ( thread::ThreadId  id,
McsBlockIndex  index 
)

Dereference other thread's block index for reader-writer locks.

template<typename RW_BLOCK >
RW_BLOCK* foedus::xct::McsAdaptorConcept< RW_BLOCK >::get_rw_other_block ( uint32_t  block_int)

Dereference other thread's block index for reader-writer locks, but receives a block int.

template<typename RW_BLOCK >
McsWwBlock* foedus::xct::McsAdaptorConcept< RW_BLOCK >::get_ww_my_block ( McsBlockIndex  index)

Dereference my block index for exclusive locks.

template<typename RW_BLOCK >
McsWwBlock* foedus::xct::McsAdaptorConcept< RW_BLOCK >::get_ww_other_block ( thread::ThreadId  id,
McsBlockIndex  index 
)

Dereference other thread's block index for exclusive locks.

template<typename RW_BLOCK >
McsBlockIndex foedus::xct::McsAdaptorConcept< RW_BLOCK >::issue_new_block ( )

Issues a new queue node of this thread and returns its block index.

This typically maintains a counter in the concrete object.

template<typename RW_BLOCK >
std::atomic<bool>* foedus::xct::McsAdaptorConcept< RW_BLOCK >::me_waiting ( )

Returns the atomic bool var on whether current thread is waiting for some lock.

template<typename RW_BLOCK >
std::atomic<bool>* foedus::xct::McsAdaptorConcept< RW_BLOCK >::other_waiting ( thread::ThreadId  id)

Returns the bool var on whether other thread is waiting for some lock.


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