20 #include <glog/logging.h>
46 for (
ThreadGroupId group_id = 0; group_id < options.group_count_; ++group_id) {
81 const void* task_input,
82 uint64_t task_input_size,
86 for (
size_t j = 0; j < thread_per_group; ++j) {
88 if (thread->
try_impersonate(proc_name, task_input, task_input_size, session)) {
98 const void* task_input,
99 uint64_t task_input_size,
103 for (
size_t j = 0; j < thread_per_group; ++j) {
105 if (thread->
try_impersonate(proc_name, task_input, task_input_size, session)) {
114 const void* task_input,
115 uint64_t task_input_size,
118 return thread->
try_impersonate(proc_name, task_input, task_input_size, session);
128 o <<
"</ThreadPool>";
Set of options about threads and thread-groups.
ThreadGroup * local_group_
Thread group of the local SOC engine.
ThreadRef * get_thread(ThreadLocalOrdinal ordinal)
Returns Thread object for the given ordinal in this group.
Pimpl object of ThreadPool.
void emprace_back(ErrorStack &&error_stack)
If the given ErrorStack is an error, this method adds it to the end of this batch.
A view of Thread group object for other SOCs and master engine.
#define ERROR_STACK(e)
Instantiates ErrorStack with the given foedus::error_code, creating an error stack with the current f...
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Typedefs of ID types used in thread package.
ThreadLocalOrdinal decompose_numa_local_ordinal(ThreadId global_id)
Extracts local ordinal from the given globally unique ID of Thread (core).
0x0005 : "GENERAL: A dependent module is not initialized yet. This implies a wrong initialization ord...
ErrorStack uninitialize() override final
Typical implementation of Initializable::uninitialize() that provides uninitialize-once semantics...
Brings error stacktrace information as return value of functions.
ThreadGroupRef * get_group(ThreadGroupId numa_node)
bool impersonate(const proc::ProcName &proc_name, const void *task_input, uint64_t task_input_size, ImpersonateSession *session)
Definitions of IDs in this package and a few related constant values.
A user session running on an impersonated thread.
const EngineOptions & get_options() const
ThreadLocalOrdinal thread_count_per_group_
Number of Thread in each ThreadGroup.
bool is_master() const
Returns if this engine object is a master instance.
Represents a group of pre-allocated threads running in one NUMA node.
Batches zero or more ErrorStack objects to represent in one ErrorStack.
ErrorStack initialize() override final
Typical implementation of Initializable::initialize() that provides initialize-once semantics...
A view of Thread object for other SOCs and master engine.
ThreadRef * get_thread(ThreadId id)
ThreadGroupId decompose_numa_node(ThreadId global_id)
Extracts NUMA node ID from the given globally unique ID of Thread (core).
ErrorStack initialize_once() override
std::vector< ThreadGroupRef > groups_
List of all thread groups, one for each NUMA node in this engine.
bool impersonate_on_numa_node(ThreadGroupId node, const proc::ProcName &proc_name, const void *task_input, uint64_t task_input_size, ImpersonateSession *session)
#define SUMMARIZE_ERROR_BATCH(x)
This macro calls ErrorStackBatch::summarize() with automatically provided parameters.
uint16_t SocId
Represents an ID of an SOC, or NUMA node.
bool try_impersonate(const proc::ProcName &proc_name, const void *task_input, uint64_t task_input_size, ImpersonateSession *session)
Conditionally try to occupy this thread, or impersonate.
thread::ThreadOptions thread_
#define CHECK_ERROR(x)
This macro calls x and checks its returned value.
uint16_t ThreadId
Typedef for a global ID of Thread (core), which is unique across NUMA nodes.
const ErrorStack kRetOk
Normal return value for no-error case.
bool impersonate_on_numa_core(ThreadId core, const proc::ProcName &proc_name, const void *task_input, uint64_t task_input_size, ImpersonateSession *session)
ErrorStack uninitialize_once() override
Atomic fence methods and load/store with fences that work for both C++11/non-C++11 code...
std::ostream & operator<<(std::ostream &o, const ImpersonateSession &v)
soc::SocId get_soc_id() const
If this is a child instance, returns its SOC ID (NUMA node).
0x0006 : "GENERAL: A dependent module is already uninitialized. This implies a wrong uninitialization...
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
uint8_t ThreadGroupId
Typedef for an ID of ThreadGroup (NUMA node).
memory::EngineMemory * get_memory_manager() const
See Memory Manager.
bool is_initialized() const override final
Returns whether the object has been already initialized or not.