libfoedus-core
FOEDUS Core Library
foedus::soc::MasterEngineStatus Struct Referencefinal

Current status of master engine. More...

Detailed Description

Current status of master engine.

This object is placed in shared memory, so this must not have a heap-allocated member.

Definition at line 60 of file shared_memory_repo.hpp.

#include <shared_memory_repo.hpp>

Public Types

enum  StatusCode {
  kInitial = 0, kSharedMemoryAllocated, kSharedMemoryReservedReclamation, kRunning,
  kWaitingForChildTerminate, kTerminated, kFatalError
}
 These statuses represent each step described in SocManager comment. More...
 

Public Member Functions

 MasterEngineStatus ()=delete
 
 ~MasterEngineStatus ()=delete
 
 MasterEngineStatus (const MasterEngineStatus &other)=delete
 
MasterEngineStatusoperator= (const MasterEngineStatus &other)=delete
 
void change_status_atomic (StatusCode new_status)
 Update the value of status_code_ with fence. More...
 
StatusCode read_status_atomic () const
 Read status_code_ with fence. More...
 
void change_init_atomic (ModuleType value)
 
void change_uninit_atomic (ModuleType value)
 

Public Attributes

StatusCode status_code_
 
ModuleType initialized_modules_
 The module that has been most recently initialized in master. More...
 
ModuleType uninitialized_modules_
 The module that has been most recently closed in master. More...
 

Member Enumeration Documentation

These statuses represent each step described in SocManager comment.

The status always increases one-by-one or jumps to kFatalError.

Enumerator
kInitial 

Master engine has just started.

kSharedMemoryAllocated 

Master engine successfully allocated shared memory and waiting for child's attach.

kSharedMemoryReservedReclamation 

Master engine successfully confirmed child's attach and reserved the reclamation of the shared memories.

No more attach to the memories is possible after this. Child SOCs resume their initialization after observing this status.

kRunning 

Done all initialization and running transactions.

kWaitingForChildTerminate 

The master is waiting for child engines to terminate.

As soon as child observes this, they will start termination in normal steps.

kTerminated 

The master engine has normally terminated.

This is a final status.

kFatalError 

Whenever child observes this, they will call _exit() asap.

This is a final status.

Definition at line 65 of file shared_memory_repo.hpp.

65  {
69  kInitial = 0,
80 
82  kRunning,
83 
93  };
The master engine has normally terminated.
The master is waiting for child engines to terminate.
Whenever child observes this, they will call _exit() asap.
Done all initialization and running transactions.
Master engine successfully allocated shared memory and waiting for child's attach.
Master engine successfully confirmed child's attach and reserved the reclamation of the shared memori...
Master engine has just started.

Constructor & Destructor Documentation

foedus::soc::MasterEngineStatus::MasterEngineStatus ( )
delete
foedus::soc::MasterEngineStatus::~MasterEngineStatus ( )
delete
foedus::soc::MasterEngineStatus::MasterEngineStatus ( const MasterEngineStatus other)
delete

Member Function Documentation

void foedus::soc::MasterEngineStatus::change_init_atomic ( ModuleType  value)
inline

Definition at line 115 of file shared_memory_repo.hpp.

References ASSERT_ND, initialized_modules_, and foedus::assorted::memory_fence_acq_rel().

Referenced by foedus::EnginePimpl::on_module_initialized().

115  {
116  ASSERT_ND(static_cast<int>(initialized_modules_) == static_cast<int>(value) - 1);
118  initialized_modules_ = value;
120  }
ModuleType initialized_modules_
The module that has been most recently initialized in master.
#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
void memory_fence_acq_rel()
Equivalent to std::atomic_thread_fence(std::memory_order_acq_rel).

Here is the call graph for this function:

Here is the caller graph for this function:

void foedus::soc::MasterEngineStatus::change_status_atomic ( StatusCode  new_status)
inline

Update the value of status_code_ with fence.

Definition at line 102 of file shared_memory_repo.hpp.

References ASSERT_ND, kFatalError, kWaitingForChildTerminate, foedus::assorted::memory_fence_acq_rel(), and status_code_.

Referenced by foedus::soc::SharedMemoryRepo::change_master_status(), and foedus::soc::SocManagerPimpl::report_engine_fatal_error().

102  {
103  ASSERT_ND(new_status == kFatalError || new_status == kWaitingForChildTerminate ||
104  static_cast<int>(new_status) == static_cast<int>(status_code_) + 1);
106  status_code_ = new_status;
108  }
The master is waiting for child engines to terminate.
Whenever child observes this, they will call _exit() asap.
#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
void memory_fence_acq_rel()
Equivalent to std::atomic_thread_fence(std::memory_order_acq_rel).

Here is the call graph for this function:

Here is the caller graph for this function:

void foedus::soc::MasterEngineStatus::change_uninit_atomic ( ModuleType  value)
inline

Definition at line 121 of file shared_memory_repo.hpp.

References ASSERT_ND, foedus::assorted::memory_fence_acq_rel(), and uninitialized_modules_.

Referenced by foedus::EnginePimpl::on_module_uninitialized().

121  {
122  ASSERT_ND(static_cast<int>(uninitialized_modules_) == static_cast<int>(value) + 1);
124  uninitialized_modules_ = value;
126  }
#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
ModuleType uninitialized_modules_
The module that has been most recently closed in master.
void memory_fence_acq_rel()
Equivalent to std::atomic_thread_fence(std::memory_order_acq_rel).

Here is the call graph for this function:

Here is the caller graph for this function:

MasterEngineStatus& foedus::soc::MasterEngineStatus::operator= ( const MasterEngineStatus other)
delete
StatusCode foedus::soc::MasterEngineStatus::read_status_atomic ( ) const
inline

Read status_code_ with fence.

Definition at line 110 of file shared_memory_repo.hpp.

References foedus::assorted::memory_fence_acq_rel(), and status_code_.

Referenced by foedus::soc::SharedMemoryRepo::get_master_status().

110  {
112  return status_code_;
113  }
void memory_fence_acq_rel()
Equivalent to std::atomic_thread_fence(std::memory_order_acq_rel).

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

ModuleType foedus::soc::MasterEngineStatus::initialized_modules_

The module that has been most recently initialized in master.

Used to synchronize init.

Definition at line 130 of file shared_memory_repo.hpp.

Referenced by change_init_atomic(), foedus::soc::SocManagerPimpl::initialize_master(), and foedus::soc::SocManagerPimpl::wait_for_master_module().

ModuleType foedus::soc::MasterEngineStatus::uninitialized_modules_

The module that has been most recently closed in master.

Used to synchronize uninit.

Definition at line 132 of file shared_memory_repo.hpp.

Referenced by change_uninit_atomic(), foedus::soc::SocManagerPimpl::initialize_master(), and foedus::soc::SocManagerPimpl::wait_for_master_module().


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