libfoedus-core
FOEDUS Core Library
foedus::xct::McsRwExtendedBlock Struct Reference

Pre-allocated MCS block for extended version of RW-locks. More...

Detailed Description

Pre-allocated MCS block for extended version of RW-locks.

Definition at line 513 of file xct_id.hpp.

#include <xct_id.hpp>

Collaboration diagram for foedus::xct::McsRwExtendedBlock:

Classes

union  Field
 

Public Member Functions

void mark_released ()
 
bool is_released ()
 
uint32_t read_pred_flags ()
 
uint32_t read_next_flags ()
 
bool is_writer ()
 
bool is_reader ()
 
bool pred_flag_is_waiting ()
 
bool pred_flag_is_granted ()
 
bool next_flag_is_direct_granted ()
 
bool next_flag_is_leaving_granted ()
 
bool next_flag_is_granted ()
 
bool next_flag_is_leaving ()
 
bool next_flag_is_waiting ()
 
void set_next_flag_writer_successor ()
 
void set_next_flag_reader_successor ()
 
void set_pred_flag_granted ()
 
void set_next_flag_granted ()
 
void set_next_flag_busy_granted ()
 
void set_next_flag_leaving ()
 
void set_next_flag_no_successor ()
 
void set_next (uint64_t next)
 
bool cas_next_weak (uint64_t expected, uint64_t desired)
 
bool cas_next_strong (uint64_t expected, uint64_t desired)
 
void set_flags_granted ()
 
bool next_flag_has_successor ()
 
bool next_flag_has_reader_successor ()
 
bool next_flag_has_writer_successor ()
 
bool next_flag_is_busy ()
 
void set_next_flag_busy ()
 
void unset_next_flag_busy ()
 
uint32_t cas_val_next_flag_strong (uint32_t expected, uint32_t desired)
 
uint32_t cas_val_next_flag_weak (uint32_t expected, uint32_t desired)
 
uint64_t cas_val_next_strong (uint64_t expected, uint64_t desired)
 
uint64_t cas_val_next_weak (uint64_t expected, uint64_t desired)
 
uint32_t xchg_next_id (uint32_t id)
 
bool cas_next_id_strong (uint32_t expected, uint32_t desired)
 
bool cas_next_id_weak (uint32_t expected, uint32_t desired)
 
bool cas_pred_id_weak (uint32_t expected, uint32_t desired)
 
bool cas_pred_id_strong (uint32_t expected, uint32_t desired)
 
uint32_t cas_val_pred_id_weak (uint32_t expected, uint32_t desired)
 
uint32_t make_next_flag_waiting_with_no_successor ()
 
uint32_t make_next_flag_waiting_with_reader_successor ()
 
uint32_t get_pred_id ()
 
uint32_t get_next_id ()
 
uint64_t get_next ()
 
void set_pred_id (uint32_t id)
 
void set_next_id (uint32_t id)
 
uint32_t xchg_pred_id (uint32_t id)
 
void init_reader ()
 
void init_writer ()
 
bool timeout_granted (int32_t timeout)
 

Public Attributes

Field pred_
 
Field next_
 

Static Public Attributes

static const uint32_t kPredFlagWaiting = 0U
 Pred flags: |—31—|--—|—0—| |my class|empty|waiting|. More...
 
static const uint32_t kPredFlagGranted = 1U
 
static const uint32_t kPredFlagReader = 0U
 
static const uint32_t kPredFlagWriter = 1U << 31
 
static const uint32_t kPredFlagClassMask = 1U << 31
 
static const uint32_t kSuccFlagWaiting = 0U
 
static const uint32_t kSuccFlagLeaving = 1U
 
static const uint32_t kSuccFlagDirectGranted = 2U
 
static const uint32_t kSuccFlagLeavingGranted = 3U
 
static const uint32_t kSuccFlagMask = 3U
 
static const uint32_t kSuccFlagBusy = 4U
 
static const uint32_t kSuccFlagSuccessorClassMask = 3U << 30
 
static const uint32_t kSuccFlagSuccessorReader = 3U << 30
 
static const uint32_t kSuccFlagSuccessorNone = 0U
 
static const uint32_t kSuccFlagSuccessorWriter = 1U << 30
 
static const uint32_t kSuccIdSuccessorLeaving = 0xFFFFFFFFU
 
static const uint32_t kSuccIdNoSuccessor = 0xFFFFFFFEU
 
static const uint32_t kPredIdAcquired = 0xFFFFFFFFU
 
static const uint64_t kSuccReleased = 0xFFFFFFFFFFFFFFFFU
 
static const int32_t kTimeoutNever = 0xFFFFFFFFU
 
static const int32_t kTimeoutZero = 0U
 

Class Documentation

union foedus::xct::McsRwExtendedBlock::Field

Definition at line 554 of file xct_id.hpp.

Collaboration diagram for foedus::xct::McsRwExtendedBlock::Field:
Class Members
struct Components components_
uint64_t data_

Member Function Documentation

bool foedus::xct::McsRwExtendedBlock::cas_next_id_strong ( uint32_t  expected,
uint32_t  desired 
)
inline

Definition at line 717 of file xct_id.hpp.

References foedus::xct::McsRwExtendedBlock::Field::components_, and foedus::xct::McsRwExtendedBlock::Field::Components::id_.

717  {
718  return assorted::raw_atomic_compare_exchange_strong<uint32_t>(
719  &next_.components_.id_, &expected, desired);
720  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_
bool foedus::xct::McsRwExtendedBlock::cas_next_id_weak ( uint32_t  expected,
uint32_t  desired 
)
inline

Definition at line 721 of file xct_id.hpp.

References foedus::xct::McsRwExtendedBlock::Field::components_, and foedus::xct::McsRwExtendedBlock::Field::Components::id_.

721  {
722  return assorted::raw_atomic_compare_exchange_weak<uint32_t>(
723  &next_.components_.id_, &expected, desired);
724  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_
bool foedus::xct::McsRwExtendedBlock::cas_next_strong ( uint64_t  expected,
uint64_t  desired 
)
inline

Definition at line 664 of file xct_id.hpp.

References foedus::xct::McsRwExtendedBlock::Field::data_.

664  {
665  return assorted::raw_atomic_compare_exchange_strong<uint64_t>(
666  &next_.data_, &expected, desired);
667  }
bool foedus::xct::McsRwExtendedBlock::cas_next_weak ( uint64_t  expected,
uint64_t  desired 
)
inline

Definition at line 660 of file xct_id.hpp.

References foedus::xct::McsRwExtendedBlock::Field::data_.

660  {
661  return assorted::raw_atomic_compare_exchange_weak<uint64_t>(
662  &next_.data_, &expected, desired);
663  }
bool foedus::xct::McsRwExtendedBlock::cas_pred_id_strong ( uint32_t  expected,
uint32_t  desired 
)
inline

Definition at line 729 of file xct_id.hpp.

References foedus::xct::McsRwExtendedBlock::Field::components_, and foedus::xct::McsRwExtendedBlock::Field::Components::id_.

729  {
730  return assorted::raw_atomic_compare_exchange_strong<uint32_t>(
731  &pred_.components_.id_, &expected, desired);
732  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_
bool foedus::xct::McsRwExtendedBlock::cas_pred_id_weak ( uint32_t  expected,
uint32_t  desired 
)
inline

Definition at line 725 of file xct_id.hpp.

References foedus::xct::McsRwExtendedBlock::Field::components_, and foedus::xct::McsRwExtendedBlock::Field::Components::id_.

725  {
726  return assorted::raw_atomic_compare_exchange_weak<uint32_t>(
727  &pred_.components_.id_, &expected, desired);
728  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_
uint32_t foedus::xct::McsRwExtendedBlock::cas_val_next_flag_strong ( uint32_t  expected,
uint32_t  desired 
)
inline

Definition at line 694 of file xct_id.hpp.

References foedus::xct::McsRwExtendedBlock::Field::components_, and foedus::xct::McsRwExtendedBlock::Field::Components::flags_.

694  {
695  assorted::raw_atomic_compare_exchange_strong<uint32_t>(
696  &next_.components_.flags_, &expected, desired);
697  return expected;
698  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_
uint32_t foedus::xct::McsRwExtendedBlock::cas_val_next_flag_weak ( uint32_t  expected,
uint32_t  desired 
)
inline

Definition at line 699 of file xct_id.hpp.

References foedus::xct::McsRwExtendedBlock::Field::components_, and foedus::xct::McsRwExtendedBlock::Field::Components::flags_.

699  {
700  assorted::raw_atomic_compare_exchange_weak<uint32_t>(
701  &next_.components_.flags_, &expected, desired);
702  return expected;
703  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_
uint64_t foedus::xct::McsRwExtendedBlock::cas_val_next_strong ( uint64_t  expected,
uint64_t  desired 
)
inline

Definition at line 704 of file xct_id.hpp.

References foedus::xct::McsRwExtendedBlock::Field::data_.

704  {
705  assorted::raw_atomic_compare_exchange_strong<uint64_t>(
706  &next_.data_, &expected, desired);
707  return expected;
708  }
uint64_t foedus::xct::McsRwExtendedBlock::cas_val_next_weak ( uint64_t  expected,
uint64_t  desired 
)
inline

Definition at line 709 of file xct_id.hpp.

References foedus::xct::McsRwExtendedBlock::Field::data_.

709  {
710  assorted::raw_atomic_compare_exchange_weak<uint64_t>(
711  &next_.data_, &expected, desired);
712  return expected;
713  }
uint32_t foedus::xct::McsRwExtendedBlock::cas_val_pred_id_weak ( uint32_t  expected,
uint32_t  desired 
)
inline

Definition at line 733 of file xct_id.hpp.

References foedus::xct::McsRwExtendedBlock::Field::components_, and foedus::xct::McsRwExtendedBlock::Field::Components::id_.

733  {
734  assorted::raw_atomic_compare_exchange_weak<uint32_t>(
735  &pred_.components_.id_, &expected, desired);
736  return expected;
737  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_
uint64_t foedus::xct::McsRwExtendedBlock::get_next ( )
inline

Definition at line 748 of file xct_id.hpp.

References foedus::xct::McsRwExtendedBlock::Field::data_.

Referenced by is_released().

748  {
749  return assorted::atomic_load_acquire<uint64_t>(&next_.data_);
750  }

Here is the caller graph for this function:

uint32_t foedus::xct::McsRwExtendedBlock::get_next_id ( )
inline

Definition at line 745 of file xct_id.hpp.

References foedus::xct::McsRwExtendedBlock::Field::components_, and foedus::xct::McsRwExtendedBlock::Field::Components::id_.

745  {
746  return assorted::atomic_load_acquire<uint32_t>(&next_.components_.id_);
747  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_
uint32_t foedus::xct::McsRwExtendedBlock::get_pred_id ( )
inline

Definition at line 742 of file xct_id.hpp.

References foedus::xct::McsRwExtendedBlock::Field::components_, and foedus::xct::McsRwExtendedBlock::Field::Components::id_.

742  {
743  return assorted::atomic_load_acquire<uint32_t>(&pred_.components_.id_);
744  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_
void foedus::xct::McsRwExtendedBlock::init_reader ( )
inline

Definition at line 760 of file xct_id.hpp.

References ASSERT_ND, foedus::xct::McsRwExtendedBlock::Field::components_, foedus::xct::McsRwExtendedBlock::Field::Components::flags_, foedus::xct::McsRwExtendedBlock::Field::Components::id_, is_reader(), kPredFlagReader, next_flag_is_waiting(), and pred_flag_is_waiting().

760  {
766  ASSERT_ND(is_reader());
767  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_
static const uint32_t kPredFlagReader
Definition: xct_id.hpp:524
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72

Here is the call graph for this function:

void foedus::xct::McsRwExtendedBlock::init_writer ( )
inline

Definition at line 768 of file xct_id.hpp.

References ASSERT_ND, foedus::xct::McsRwExtendedBlock::Field::components_, foedus::xct::McsRwExtendedBlock::Field::Components::flags_, foedus::xct::McsRwExtendedBlock::Field::Components::id_, is_writer(), kPredFlagWriter, next_flag_is_waiting(), and pred_flag_is_waiting().

768  {
774  ASSERT_ND(is_writer());
775  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_
static const uint32_t kPredFlagWriter
Definition: xct_id.hpp:525
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72

Here is the call graph for this function:

bool foedus::xct::McsRwExtendedBlock::is_reader ( )
inline

Definition at line 584 of file xct_id.hpp.

References is_writer().

Referenced by init_reader().

584 { return !is_writer(); }

Here is the call graph for this function:

Here is the caller graph for this function:

bool foedus::xct::McsRwExtendedBlock::is_released ( )
inline

Definition at line 572 of file xct_id.hpp.

References get_next(), and kSuccReleased.

572  {
573  return get_next() == kSuccReleased;
574  }
static const uint64_t kSuccReleased
Definition: xct_id.hpp:547

Here is the call graph for this function:

bool foedus::xct::McsRwExtendedBlock::is_writer ( )
inline

Definition at line 583 of file xct_id.hpp.

References kPredFlagWriter, and read_pred_flags().

Referenced by init_writer(), and is_reader().

583 { return read_pred_flags() & kPredFlagWriter; }
static const uint32_t kPredFlagWriter
Definition: xct_id.hpp:525

Here is the call graph for this function:

Here is the caller graph for this function:

uint32_t foedus::xct::McsRwExtendedBlock::make_next_flag_waiting_with_no_successor ( )
inline

Definition at line 738 of file xct_id.hpp.

References kSuccFlagWaiting.

738 { return kSuccFlagWaiting; }
static const uint32_t kSuccFlagWaiting
Definition: xct_id.hpp:528
uint32_t foedus::xct::McsRwExtendedBlock::make_next_flag_waiting_with_reader_successor ( )
inline

Definition at line 739 of file xct_id.hpp.

References kSuccFlagSuccessorReader.

739  {
741  }
static const uint32_t kSuccFlagWaiting
Definition: xct_id.hpp:528
static const uint32_t kSuccFlagSuccessorReader
Definition: xct_id.hpp:537
void foedus::xct::McsRwExtendedBlock::mark_released ( )
inline

Definition at line 566 of file xct_id.hpp.

References ASSERT_ND, next_flag_is_granted(), pred_flag_is_granted(), and set_next().

566  {
570  }
static const uint64_t kSuccReleased
Definition: xct_id.hpp:547
void set_next(uint64_t next)
Definition: xct_id.hpp:657
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72

Here is the call graph for this function:

bool foedus::xct::McsRwExtendedBlock::next_flag_has_reader_successor ( )
inline

Definition at line 675 of file xct_id.hpp.

References kSuccFlagSuccessorReader, and read_next_flags().

675  {
677  }
static const uint32_t kSuccFlagSuccessorReader
Definition: xct_id.hpp:537
static const uint32_t kSuccFlagSuccessorClassMask
Definition: xct_id.hpp:536

Here is the call graph for this function:

bool foedus::xct::McsRwExtendedBlock::next_flag_has_successor ( )
inline

Definition at line 672 of file xct_id.hpp.

References kSuccFlagSuccessorClassMask, and read_next_flags().

Referenced by set_next_flag_reader_successor(), and set_next_flag_writer_successor().

672  {
674  }
static const uint32_t kSuccFlagSuccessorClassMask
Definition: xct_id.hpp:536

Here is the call graph for this function:

Here is the caller graph for this function:

bool foedus::xct::McsRwExtendedBlock::next_flag_has_writer_successor ( )
inline

Definition at line 678 of file xct_id.hpp.

References kSuccFlagSuccessorWriter, and read_next_flags().

678  {
680  }
static const uint32_t kSuccFlagSuccessorWriter
Definition: xct_id.hpp:539
static const uint32_t kSuccFlagSuccessorClassMask
Definition: xct_id.hpp:536

Here is the call graph for this function:

bool foedus::xct::McsRwExtendedBlock::next_flag_is_busy ( )
inline

Definition at line 681 of file xct_id.hpp.

References kSuccFlagBusy, and read_next_flags().

Referenced by set_next_flag_busy(), and unset_next_flag_busy().

681  {
683  }
static const uint32_t kSuccFlagBusy
Definition: xct_id.hpp:534

Here is the call graph for this function:

Here is the caller graph for this function:

bool foedus::xct::McsRwExtendedBlock::next_flag_is_direct_granted ( )
inline

Definition at line 591 of file xct_id.hpp.

References kSuccFlagDirectGranted, kSuccFlagMask, and read_next_flags().

591  {
592  uint32_t f = (read_next_flags() & kSuccFlagMask);
593  return f == kSuccFlagDirectGranted;
594  }
static const uint32_t kSuccFlagMask
Definition: xct_id.hpp:532
static const uint32_t kSuccFlagDirectGranted
Definition: xct_id.hpp:530

Here is the call graph for this function:

bool foedus::xct::McsRwExtendedBlock::next_flag_is_granted ( )
inline

Definition at line 599 of file xct_id.hpp.

References kSuccFlagDirectGranted, kSuccFlagMask, and read_next_flags().

Referenced by mark_released().

599  {
600  uint32_t f = (read_next_flags() & kSuccFlagMask);
602  }
static const uint32_t kSuccFlagMask
Definition: xct_id.hpp:532
static const uint32_t kSuccFlagLeavingGranted
Definition: xct_id.hpp:531
static const uint32_t kSuccFlagDirectGranted
Definition: xct_id.hpp:530

Here is the call graph for this function:

Here is the caller graph for this function:

bool foedus::xct::McsRwExtendedBlock::next_flag_is_leaving ( )
inline

Definition at line 603 of file xct_id.hpp.

References kSuccFlagLeaving, and read_next_flags().

Referenced by set_next_flag_busy_granted(), and set_next_flag_granted().

603  {
605  }
static const uint32_t kSuccFlagMask
Definition: xct_id.hpp:532
static const uint32_t kSuccFlagLeaving
Definition: xct_id.hpp:529

Here is the call graph for this function:

Here is the caller graph for this function:

bool foedus::xct::McsRwExtendedBlock::next_flag_is_leaving_granted ( )
inline

Definition at line 595 of file xct_id.hpp.

References kSuccFlagLeavingGranted, kSuccFlagMask, and read_next_flags().

595  {
596  uint32_t f = (read_next_flags() & kSuccFlagMask);
597  return f == kSuccFlagLeavingGranted;
598  }
static const uint32_t kSuccFlagMask
Definition: xct_id.hpp:532
static const uint32_t kSuccFlagLeavingGranted
Definition: xct_id.hpp:531

Here is the call graph for this function:

bool foedus::xct::McsRwExtendedBlock::next_flag_is_waiting ( )
inline

Definition at line 606 of file xct_id.hpp.

References kSuccFlagWaiting, and read_next_flags().

Referenced by init_reader(), init_writer(), set_next_flag_busy_granted(), and set_next_flag_granted().

606  {
608  }
static const uint32_t kSuccFlagWaiting
Definition: xct_id.hpp:528
static const uint32_t kSuccFlagMask
Definition: xct_id.hpp:532

Here is the call graph for this function:

Here is the caller graph for this function:

bool foedus::xct::McsRwExtendedBlock::pred_flag_is_granted ( )
inline

Definition at line 588 of file xct_id.hpp.

References kPredFlagGranted, and read_pred_flags().

Referenced by mark_released(), pred_flag_is_waiting(), set_next_flag_busy_granted(), set_next_flag_granted(), and timeout_granted().

588  {
590  }
static const uint32_t kPredFlagGranted
Definition: xct_id.hpp:523

Here is the call graph for this function:

Here is the caller graph for this function:

bool foedus::xct::McsRwExtendedBlock::pred_flag_is_waiting ( )
inline

Definition at line 585 of file xct_id.hpp.

References pred_flag_is_granted().

Referenced by init_reader(), init_writer(), and set_pred_flag_granted().

585  {
586  return !pred_flag_is_granted();
587  }

Here is the call graph for this function:

Here is the caller graph for this function:

uint32_t foedus::xct::McsRwExtendedBlock::read_next_flags ( )
inline
uint32_t foedus::xct::McsRwExtendedBlock::read_pred_flags ( )
inline

Definition at line 577 of file xct_id.hpp.

References foedus::xct::McsRwExtendedBlock::Field::components_, and foedus::xct::McsRwExtendedBlock::Field::Components::flags_.

Referenced by is_writer(), and pred_flag_is_granted().

577  {
578  return assorted::atomic_load_acquire<uint32_t>(&pred_.components_.flags_);
579  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_

Here is the caller graph for this function:

void foedus::xct::McsRwExtendedBlock::set_flags_granted ( )
inline

Definition at line 668 of file xct_id.hpp.

References set_next_flag_granted(), and set_pred_flag_granted().

668  {
671  }

Here is the call graph for this function:

void foedus::xct::McsRwExtendedBlock::set_next ( uint64_t  next)
inline

Definition at line 657 of file xct_id.hpp.

References foedus::xct::McsRwExtendedBlock::Field::data_.

Referenced by mark_released().

657  {
658  assorted::atomic_store_release<uint64_t>(&next_.data_, next);
659  }

Here is the caller graph for this function:

void foedus::xct::McsRwExtendedBlock::set_next_flag_busy ( )
inline

Definition at line 684 of file xct_id.hpp.

References ASSERT_ND, foedus::xct::McsRwExtendedBlock::Field::components_, foedus::xct::McsRwExtendedBlock::Field::Components::flags_, kSuccFlagBusy, and next_flag_is_busy().

684  {
686  assorted::raw_atomic_fetch_and_bitwise_or<uint32_t>(
688  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_
static const uint32_t kSuccFlagBusy
Definition: xct_id.hpp:534
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72

Here is the call graph for this function:

void foedus::xct::McsRwExtendedBlock::set_next_flag_busy_granted ( )
inline

Definition at line 636 of file xct_id.hpp.

References ASSERT_ND, foedus::xct::McsRwExtendedBlock::Field::components_, foedus::xct::McsRwExtendedBlock::Field::Components::flags_, kSuccFlagBusy, next_flag_is_leaving(), next_flag_is_waiting(), and pred_flag_is_granted().

636  {
639  if (next_flag_is_waiting()) {
640  assorted::raw_atomic_fetch_and_bitwise_or<uint32_t>(
642  } else {
644  assorted::raw_atomic_fetch_and_bitwise_or<uint32_t>(
646  }
647  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_
static const uint32_t kSuccFlagBusy
Definition: xct_id.hpp:534
static const uint32_t kSuccFlagLeavingGranted
Definition: xct_id.hpp:531
static const uint32_t kSuccFlagDirectGranted
Definition: xct_id.hpp:530
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72

Here is the call graph for this function:

void foedus::xct::McsRwExtendedBlock::set_next_flag_granted ( )
inline

Definition at line 624 of file xct_id.hpp.

References ASSERT_ND, foedus::xct::McsRwExtendedBlock::Field::components_, foedus::xct::McsRwExtendedBlock::Field::Components::flags_, kSuccFlagDirectGranted, kSuccFlagLeavingGranted, next_flag_is_leaving(), next_flag_is_waiting(), and pred_flag_is_granted().

Referenced by set_flags_granted().

624  {
627  if (next_flag_is_waiting()) {
628  assorted::raw_atomic_fetch_and_bitwise_or<uint32_t>(
630  } else {
632  assorted::raw_atomic_fetch_and_bitwise_or<uint32_t>(
634  }
635  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_
static const uint32_t kSuccFlagLeavingGranted
Definition: xct_id.hpp:531
static const uint32_t kSuccFlagDirectGranted
Definition: xct_id.hpp:530
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72

Here is the call graph for this function:

Here is the caller graph for this function:

void foedus::xct::McsRwExtendedBlock::set_next_flag_leaving ( )
inline

Definition at line 648 of file xct_id.hpp.

References foedus::xct::McsRwExtendedBlock::Field::components_, and foedus::xct::McsRwExtendedBlock::Field::Components::flags_.

648  {
649  assorted::raw_atomic_exchange<uint16_t>(
650  reinterpret_cast<uint16_t*>(&next_.components_.flags_),
651  static_cast<uint16_t>(kSuccFlagLeaving));
652  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_
static const uint32_t kSuccFlagLeaving
Definition: xct_id.hpp:529
void foedus::xct::McsRwExtendedBlock::set_next_flag_no_successor ( )
inline

Definition at line 653 of file xct_id.hpp.

References foedus::xct::McsRwExtendedBlock::Field::components_, and foedus::xct::McsRwExtendedBlock::Field::Components::flags_.

653  {
654  assorted::raw_atomic_fetch_and_bitwise_and<uint32_t>(
656  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_
static const uint32_t kSuccFlagSuccessorClassMask
Definition: xct_id.hpp:536
void foedus::xct::McsRwExtendedBlock::set_next_flag_reader_successor ( )
inline

Definition at line 614 of file xct_id.hpp.

References ASSERT_ND, foedus::xct::McsRwExtendedBlock::Field::components_, foedus::xct::McsRwExtendedBlock::Field::Components::flags_, kSuccFlagSuccessorReader, and next_flag_has_successor().

614  {
616  assorted::raw_atomic_fetch_and_bitwise_or<uint32_t>(
618  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_
static const uint32_t kSuccFlagSuccessorReader
Definition: xct_id.hpp:537
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72

Here is the call graph for this function:

void foedus::xct::McsRwExtendedBlock::set_next_flag_writer_successor ( )
inline

Definition at line 609 of file xct_id.hpp.

References ASSERT_ND, foedus::xct::McsRwExtendedBlock::Field::components_, foedus::xct::McsRwExtendedBlock::Field::Components::flags_, kSuccFlagSuccessorWriter, and next_flag_has_successor().

609  {
611  assorted::raw_atomic_fetch_and_bitwise_or<uint32_t>(
613  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_
static const uint32_t kSuccFlagSuccessorWriter
Definition: xct_id.hpp:539
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72

Here is the call graph for this function:

void foedus::xct::McsRwExtendedBlock::set_next_id ( uint32_t  id)
inline

Definition at line 754 of file xct_id.hpp.

References foedus::xct::McsRwExtendedBlock::Field::components_, and foedus::xct::McsRwExtendedBlock::Field::Components::id_.

754  {
755  assorted::atomic_store_release<uint32_t>(&next_.components_.id_, id);
756  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_
void foedus::xct::McsRwExtendedBlock::set_pred_flag_granted ( )
inline

Definition at line 619 of file xct_id.hpp.

References ASSERT_ND, foedus::xct::McsRwExtendedBlock::Field::components_, foedus::xct::McsRwExtendedBlock::Field::Components::flags_, kPredFlagGranted, and pred_flag_is_waiting().

Referenced by set_flags_granted().

619  {
621  assorted::raw_atomic_fetch_and_bitwise_or<uint32_t>(
623  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_
static const uint32_t kPredFlagGranted
Definition: xct_id.hpp:523
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72

Here is the call graph for this function:

Here is the caller graph for this function:

void foedus::xct::McsRwExtendedBlock::set_pred_id ( uint32_t  id)
inline

Definition at line 751 of file xct_id.hpp.

References foedus::xct::McsRwExtendedBlock::Field::components_, and foedus::xct::McsRwExtendedBlock::Field::Components::id_.

751  {
752  assorted::atomic_store_release<uint32_t>(&pred_.components_.id_, id);
753  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_
bool foedus::xct::McsRwExtendedBlock::timeout_granted ( int32_t  timeout)

Definition at line 148 of file xct_id.cpp.

References ASSERT_ND, kTimeoutNever, kTimeoutZero, pred_flag_is_granted(), foedus::assorted::spin_until(), and foedus::assorted::yield_if_valgrind().

148  {
149  if (timeout == kTimeoutZero) {
150  return pred_flag_is_granted();
151  } else if (timeout == kTimeoutNever) {
152  assorted::spin_until([this]{ return this->pred_flag_is_granted(); });
154  } else {
155  int32_t cycles = 0;
156  do {
157  if (pred_flag_is_granted()) {
158  return true;
159  }
161  } while (++cycles < timeout);
162  }
163  return pred_flag_is_granted();
164 }
uint64_t spin_until(COND spin_until_cond)
Spin locally until the given condition returns true.
static const int32_t kTimeoutZero
Definition: xct_id.hpp:552
static const int32_t kTimeoutNever
Definition: xct_id.hpp:551
void yield_if_valgrind()
Use this in your while as a stop-gap before switching to spin_until().
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72

Here is the call graph for this function:

void foedus::xct::McsRwExtendedBlock::unset_next_flag_busy ( )
inline

Definition at line 689 of file xct_id.hpp.

References ASSERT_ND, foedus::xct::McsRwExtendedBlock::Field::components_, foedus::xct::McsRwExtendedBlock::Field::Components::flags_, and next_flag_is_busy().

689  {
691  assorted::raw_atomic_fetch_and_bitwise_and<uint32_t>(
693  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_
static const uint32_t kSuccFlagBusy
Definition: xct_id.hpp:534
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72

Here is the call graph for this function:

uint32_t foedus::xct::McsRwExtendedBlock::xchg_next_id ( uint32_t  id)
inline

Definition at line 714 of file xct_id.hpp.

References foedus::xct::McsRwExtendedBlock::Field::components_, and foedus::xct::McsRwExtendedBlock::Field::Components::id_.

714  {
715  return assorted::raw_atomic_exchange<uint32_t>(&next_.components_.id_, id);
716  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_
uint32_t foedus::xct::McsRwExtendedBlock::xchg_pred_id ( uint32_t  id)
inline

Definition at line 757 of file xct_id.hpp.

References foedus::xct::McsRwExtendedBlock::Field::components_, and foedus::xct::McsRwExtendedBlock::Field::Components::id_.

757  {
758  return assorted::raw_atomic_exchange<uint32_t>(&pred_.components_.id_, id);
759  }
struct foedus::xct::McsRwExtendedBlock::Field::Components components_

Member Data Documentation

const uint32_t foedus::xct::McsRwExtendedBlock::kPredFlagClassMask = 1U << 31
static

Definition at line 526 of file xct_id.hpp.

const uint32_t foedus::xct::McsRwExtendedBlock::kPredFlagGranted = 1U
static

Definition at line 523 of file xct_id.hpp.

Referenced by pred_flag_is_granted(), and set_pred_flag_granted().

const uint32_t foedus::xct::McsRwExtendedBlock::kPredFlagReader = 0U
static

Definition at line 524 of file xct_id.hpp.

Referenced by init_reader().

const uint32_t foedus::xct::McsRwExtendedBlock::kPredFlagWaiting = 0U
static

Pred flags: |—31—|--—|—0—| |my class|empty|waiting|.

Next flags: |--—31-30--—|--—|-2–|–1-0–| |successor class|empty|busy|waiting|

Definition at line 522 of file xct_id.hpp.

const uint32_t foedus::xct::McsRwExtendedBlock::kPredFlagWriter = 1U << 31
static

Definition at line 525 of file xct_id.hpp.

Referenced by init_writer(), and is_writer().

const uint32_t foedus::xct::McsRwExtendedBlock::kPredIdAcquired = 0xFFFFFFFFU
static

Definition at line 544 of file xct_id.hpp.

const uint32_t foedus::xct::McsRwExtendedBlock::kSuccFlagBusy = 4U
static

Definition at line 534 of file xct_id.hpp.

Referenced by next_flag_is_busy(), set_next_flag_busy(), and set_next_flag_busy_granted().

const uint32_t foedus::xct::McsRwExtendedBlock::kSuccFlagDirectGranted = 2U
static
const uint32_t foedus::xct::McsRwExtendedBlock::kSuccFlagLeaving = 1U
static

Definition at line 529 of file xct_id.hpp.

Referenced by next_flag_is_leaving().

const uint32_t foedus::xct::McsRwExtendedBlock::kSuccFlagLeavingGranted = 3U
static

Definition at line 531 of file xct_id.hpp.

Referenced by next_flag_is_leaving_granted(), and set_next_flag_granted().

const uint32_t foedus::xct::McsRwExtendedBlock::kSuccFlagMask = 3U
static
const uint32_t foedus::xct::McsRwExtendedBlock::kSuccFlagSuccessorClassMask = 3U << 30
static

Definition at line 536 of file xct_id.hpp.

Referenced by next_flag_has_successor().

const uint32_t foedus::xct::McsRwExtendedBlock::kSuccFlagSuccessorNone = 0U
static

Definition at line 538 of file xct_id.hpp.

const uint32_t foedus::xct::McsRwExtendedBlock::kSuccFlagSuccessorReader = 3U << 30
static
const uint32_t foedus::xct::McsRwExtendedBlock::kSuccFlagSuccessorWriter = 1U << 30
static

Definition at line 539 of file xct_id.hpp.

Referenced by next_flag_has_writer_successor(), and set_next_flag_writer_successor().

const uint32_t foedus::xct::McsRwExtendedBlock::kSuccFlagWaiting = 0U
static

Definition at line 528 of file xct_id.hpp.

Referenced by make_next_flag_waiting_with_no_successor(), and next_flag_is_waiting().

const uint32_t foedus::xct::McsRwExtendedBlock::kSuccIdNoSuccessor = 0xFFFFFFFEU
static

Definition at line 542 of file xct_id.hpp.

const uint32_t foedus::xct::McsRwExtendedBlock::kSuccIdSuccessorLeaving = 0xFFFFFFFFU
static

Definition at line 541 of file xct_id.hpp.

const uint64_t foedus::xct::McsRwExtendedBlock::kSuccReleased = 0xFFFFFFFFFFFFFFFFU
static

Definition at line 547 of file xct_id.hpp.

Referenced by is_released().

const int32_t foedus::xct::McsRwExtendedBlock::kTimeoutNever = 0xFFFFFFFFU
static
const int32_t foedus::xct::McsRwExtendedBlock::kTimeoutZero = 0U
static
Field foedus::xct::McsRwExtendedBlock::next_

Definition at line 563 of file xct_id.hpp.

Field foedus::xct::McsRwExtendedBlock::pred_

Definition at line 562 of file xct_id.hpp.


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