libfoedus-core
FOEDUS Core Library
|
Defines an adapter template interface for our MCS lock classes. More...
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.
RW_BLOCK | Queue 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... | |
McsWwBlock * | get_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... | |
McsWwBlock * | get_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... | |
McsRwExtendedBlock * | get_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) |
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.
void foedus::xct::McsAdaptorConcept< RW_BLOCK >::add_rw_async_mapping | ( | xct::McsRwLock * | lock, |
xct::McsBlockIndex | block_index | ||
) |
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.
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
McsBlockIndex foedus::xct::McsAdaptorConcept< RW_BLOCK >::get_cur_block | ( | ) | const |
thread::ThreadId foedus::xct::McsAdaptorConcept< RW_BLOCK >::get_my_id | ( | ) | const |
Returns thread-Id of this thread.
thread::ThreadGroupId foedus::xct::McsAdaptorConcept< RW_BLOCK >::get_my_numa_node | ( | ) | const |
Returns group-Id of this thread.
McsBlockIndex foedus::xct::McsAdaptorConcept< RW_BLOCK >::get_other_cur_block | ( | thread::ThreadId | id | ) |
RW_BLOCK* foedus::xct::McsAdaptorConcept< RW_BLOCK >::get_rw_my_block | ( | McsBlockIndex | index | ) |
Dereference my block index for reader-writer locks.
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.
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.
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.
McsWwBlock* foedus::xct::McsAdaptorConcept< RW_BLOCK >::get_ww_my_block | ( | McsBlockIndex | index | ) |
Dereference my block index for exclusive locks.
McsWwBlock* foedus::xct::McsAdaptorConcept< RW_BLOCK >::get_ww_other_block | ( | thread::ThreadId | id, |
McsBlockIndex | index | ||
) |
Dereference other thread's block index for exclusive locks.
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.
std::atomic<bool>* foedus::xct::McsAdaptorConcept< RW_BLOCK >::me_waiting | ( | ) |
Returns the atomic bool var on whether current thread is waiting for some lock.
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.