libfoedus-core
FOEDUS Core Library
thread_group.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2015, Hewlett-Packard Development Company, LP.
3  * This program is free software; you can redistribute it and/or modify it
4  * under the terms of the GNU General Public License as published by the Free
5  * Software Foundation; either version 2 of the License, or (at your option)
6  * any later version.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11  * more details. You should have received a copy of the GNU General Public
12  * License along with this program; if not, write to the Free Software
13  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14  *
15  * HP designates this particular file as subject to the "Classpath" exception
16  * as provided by HP in the LICENSE.txt file that accompanied this code.
17  */
18 #ifndef FOEDUS_THREAD_THREAD_GROUP_HPP_
19 #define FOEDUS_THREAD_THREAD_GROUP_HPP_
20 
21 #include <iosfwd>
22 #include <vector>
23 
24 #include "foedus/cxx11.hpp"
25 #include "foedus/fwd.hpp"
26 #include "foedus/initializable.hpp"
27 #include "foedus/memory/fwd.hpp"
28 #include "foedus/thread/fwd.hpp"
29 
30 namespace foedus {
31 namespace thread {
39  public:
41  ThreadGroup(Engine* engine, ThreadGroupId group_id);
42  ~ThreadGroup();
45 
46  ThreadGroupId get_group_id() const { return group_id_; }
47  memory::NumaNodeMemory* get_node_memory() const { return node_memory_; }
48 
50  Thread* get_thread(ThreadLocalOrdinal ordinal) const { return threads_[ordinal]; }
51 
52  friend std::ostream& operator<<(std::ostream& o, const ThreadGroup& v);
53 
54  private:
55  Engine* const engine_;
56 
58  ThreadGroupId group_id_;
59 
65  memory::NumaNodeMemory* node_memory_;
66 
70  std::vector<Thread*> threads_;
71 };
72 
73 } // namespace thread
74 } // namespace foedus
75 #endif // FOEDUS_THREAD_THREAD_GROUP_HPP_
ErrorStack initialize_once() override
friend std::ostream & operator<<(std::ostream &o, const ThreadGroup &v)
uint8_t ThreadLocalOrdinal
Typedef for a local ID of Thread (core), which is NOT unique across NUMA nodes.
Definition: thread_id.hpp:58
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Definition: assert_nd.hpp:44
Represents one thread running on one NUMA core.
Definition: thread.hpp:48
ThreadGroupId get_group_id() const
Forward declarations of classes in root package.
Brings error stacktrace information as return value of functions.
Definition: error_stack.hpp:81
Typical implementation of Initializable as a skeleton base class.
ErrorStack uninitialize_once() override
Represents a group of pre-allocated threads running in one NUMA node.
#define CXX11_FINAL
Used in public headers in place of "final" of C++11.
Definition: cxx11.hpp:131
Database engine object that holds all resources and provides APIs.
Definition: engine.hpp:109
memory::NumaNodeMemory * get_node_memory() const
Repository of memories dynamically acquired and shared within one NUMA node (socket).
Thread * get_thread(ThreadLocalOrdinal ordinal) const
Returns Thread object for the given ordinal in this group.
Forward declarations of classes in memory package.
#define CXX11_OVERRIDE
Used in public headers in place of "override" of C++11.
Definition: cxx11.hpp:134
#define CXX11_FUNC_DELETE
Used in public headers in place of " = delete" of C++11.
Definition: cxx11.hpp:128
Forward declarations of classes in thread package.
uint8_t ThreadGroupId
Typedef for an ID of ThreadGroup (NUMA node).
Definition: thread_id.hpp:38