top | up | prev | next

ThreadPool Class

Definition at line 98 of Thread.cpp

Constructors

ThreadPool()

Member Functions

void Done() static
void Exit()
void Init() static
ThreadPool& Instance() static
bool JoinThread(int32_t threadId)
int32_t StartThreadFunction(ThreadFunction fun)
int32_t StartThreadFunction(ThreadFunctionWithParam fun, void* param)
int32_t StartThreadMethod(ThreadMethod method, void* object)
int32_t StartThreadMethod(ThreadMethodWithParam method, void* object, void* param)

Member Variables

std::unique_ptr<ThreadPool> instance static
std::mutex mtx
std::atomic<int32_t> nextThreadId
std::vector<std::unique_ptr<std::thread>> noLockThreads
const int32_t numNoLockThreads
std::unordered_map<int32_t, std::unique_ptr<std::thread>> threadMap

Constructor Details

ThreadPool Constructor

cmajor::rt::ThreadPool::ThreadPool()

Definition at line 154 of Thread.cpp :
154 : nextThreadId(1)noLockThreads()
155 {
156     noLockThreads.resize(numNoLockThreads);
157 }


Declaration at line 117 of Thread.cpp


Member Function Details

Done Member Function

void cmajor::rt::ThreadPool::Done() static

Definition at line 143 of Thread.cpp :
144 {
145     if (instance)
146     {
147         instance->Exit();
148     }
149     instance.reset();
150 }


Declaration at line 102 of Thread.cpp

Calls: cmajor::rt::ThreadPool::Exit


Exit Member Function

void cmajor::rt::ThreadPool::Exit()

Definition at line 120 of Thread.cpp
Declaration at line 103 of Thread.cpp

Calls: cmajor::rt::ThreadPool::JoinThread

Called by: cmajor::rt::ThreadPool::Done


Init Member Function

void cmajor::rt::ThreadPool::Init() static

Definition at line 138 of Thread.cpp :
139 {
140     instance.reset(new ThreadPool());
141 }


Declaration at line 101 of Thread.cpp


Instance Member Function

ThreadPool & cmajor::rt::ThreadPool::Instance() static

Definition at line 104 of Thread.cpp :
104 { Assert(instance"thread pool not initialized"); return *instance; }


JoinThread Member Function

bool cmajor::rt::ThreadPool::JoinThread(int32_t threadId)

Definition at line 223 of Thread.cpp
Declaration at line 109 of Thread.cpp

Called by: cmajor::rt::ThreadPool::Exit


StartThreadFunction Member Function

int32_t cmajor::rt::ThreadPool::StartThreadFunction(ThreadFunction fun)

Definition at line 159 of Thread.cpp
Declaration at line 105 of Thread.cpp


StartThreadFunction Member Function

int32_t cmajor::rt::ThreadPool::StartThreadFunction(ThreadFunctionWithParam fun, void * param)

Definition at line 175 of Thread.cpp
Declaration at line 106 of Thread.cpp


StartThreadMethod Member Function

int32_t cmajor::rt::ThreadPool::StartThreadMethod(ThreadMethod method, void * object)

Definition at line 191 of Thread.cpp
Declaration at line 107 of Thread.cpp


StartThreadMethod Member Function

int32_t cmajor::rt::ThreadPool::StartThreadMethod(ThreadMethodWithParam method, void * object, void * param)

Definition at line 207 of Thread.cpp
Declaration at line 108 of Thread.cpp


top | up | prev | next