NCBI C++ ToolKit
|
#include "scheduler.hpp"
Go to the source code of this file.
Go to the SVN repository for this file.
Classes | |
struct | SSrvThread |
Enumerations | |
enum | EThreadState { eThreadStarting , eThreadRunning , eThreadRevived , eThreadLockedForStop , eThreadStopped , eThreadReleased , eThreadDormant } |
enum | EThreadMgrState { eThrMgrIdle , eThrMgrPreparesToStop , eThrMgrThreadExited , eThrMgrSocksMoved , eThrMgrNeedNewThread , eThrMgrStarting } |
Functions | |
void | InitCurThreadStorage (void) |
SSrvThread * | GetCurThread (void) |
void | ConfigureThreads (const CNcbiRegistry *reg, CTempString section) |
bool | ReConfig_Threads (const CTempString §ion, const CNcbiRegistry &new_reg, string &err_message) |
void | WriteSetup_Threads (CSrvSocketTask &task) |
bool | InitThreadsMan (void) |
void | RunMainThread (void) |
void | FinalizeThreadsMan (void) |
void | RequestThreadStart (SSrvThread *thr) |
void | RequestThreadStop (SSrvThread *thr) |
void | RequestThreadRevive (SSrvThread *thr) |
TSrvThreadNum | GetCntRunningThreads (void) |
bool | IsThreadRunning (SSrvThread *thr) |
enum EThreadMgrState |
Enumerator | |
---|---|
eThrMgrIdle | |
eThrMgrPreparesToStop | |
eThrMgrThreadExited | |
eThrMgrSocksMoved | |
eThrMgrNeedNewThread | |
eThrMgrStarting |
Definition at line 104 of file threads_man.hpp.
enum EThreadState |
Enumerator | |
---|---|
eThreadStarting | |
eThreadRunning | |
eThreadRevived | |
eThreadLockedForStop | |
eThreadStopped | |
eThreadReleased | |
eThreadDormant |
Definition at line 67 of file threads_man.hpp.
void ConfigureThreads | ( | const CNcbiRegistry * | reg, |
CTempString | section | ||
) |
Definition at line 443 of file threads_man.cpp.
References IRegistry::GetInt(), kMaxNumberOfThreads, and s_MaxRunningThreads.
Referenced by s_ReadConfiguration().
void FinalizeThreadsMan | ( | void | ) |
Definition at line 497 of file threads_man.cpp.
Referenced by CTaskServer::Finalize().
TSrvThreadNum GetCntRunningThreads | ( | void | ) |
Definition at line 102 of file threads_man.cpp.
References i, IsThreadRunning(), result, s_MaxRunningThreads, and s_Threads.
Referenced by s_DoFatalAbort(), and s_SaveState().
SSrvThread* GetCurThread | ( | void | ) |
Definition at line 82 of file threads_man.cpp.
Referenced by CSrvRCUUser::CallRCU(), CSrvSocketTask::Connect(), CMMFlusher::ExecuteSlice(), CTaskServer::GetCurThreadNum(), ReleaseThreadSched(), s_AddTaskToQueue(), s_CheckFatalAbort(), s_CleanSockResources(), s_GetCurPoolsSet(), s_LogWithErrStr(), s_SaveSocket(), CSrvStat::SaveEndStateStat(), SchedCheckOverloads(), CSrvTask::SetRunnable(), and CSrvSocketTask::StartProcessing().
void InitCurThreadStorage | ( | void | ) |
Definition at line 431 of file threads_man.cpp.
References NULL, and SRV_FATAL.
Referenced by s_LowLevelInit().
bool InitThreadsMan | ( | void | ) |
Definition at line 462 of file threads_man.cpp.
References calloc(), eThreadDormant, i, RCUInitNewThread(), s_AllocThread(), s_MainThr, s_MaxRunningThreads, s_SetCurThread(), s_SvcThr, s_Threads, and SSrvThread::thread_state.
Referenced by CTaskServer::Initialize().
|
inline |
Definition at line 119 of file threads_man.hpp.
References eThreadRevived, and thr.
Referenced by GetCntRunningThreads(), RunMainThread(), s_AddTaskToQueue(), s_FindQueueThread(), SchedCheckOverloads(), SchedExecuteTask(), and SchedStartJiffy().
bool ReConfig_Threads | ( | const CTempString & | section, |
const CNcbiRegistry & | new_reg, | ||
string & | err_message | ||
) |
Definition at line 450 of file threads_man.cpp.
Referenced by CTaskServer::ReConfig().
void RequestThreadRevive | ( | SSrvThread * | thr | ) |
Definition at line 382 of file threads_man.cpp.
References eThreadLockedForStop, eThreadRevived, eThrMgrIdle, eThrMgrPreparesToStop, CMiniMutex::Lock(), NULL, s_CurMgrThread, s_ThreadMgrState, s_ThrMgrLock, SRV_FATAL, thr, and CMiniMutex::Unlock().
Referenced by SchedExecuteTask().
void RequestThreadStart | ( | SSrvThread * | thr | ) |
Definition at line 351 of file threads_man.cpp.
References eThreadReleased, eThreadStarting, eThrMgrIdle, eThrMgrNeedNewThread, CTaskServer::IsInShutdown(), CMiniMutex::Lock(), s_CurMgrThread, s_ThreadMgrState, s_ThrMgrLock, thr, and CMiniMutex::Unlock().
Referenced by s_FindQueueThread().
void RequestThreadStop | ( | SSrvThread * | thr | ) |
Definition at line 366 of file threads_man.cpp.
References eThreadLockedForStop, eThreadRunning, eThrMgrIdle, eThrMgrPreparesToStop, CTaskServer::IsInShutdown(), CMiniMutex::Lock(), s_CurMgrThread, s_ThreadMgrState, s_ThrMgrLock, thr, and CMiniMutex::Unlock().
Referenced by SchedStartJiffy().
void RunMainThread | ( | void | ) |
Definition at line 481 of file threads_man.cpp.
References DoSocketWait(), eSrvFastShutdown, IsServerStopping(), IsThreadRunning(), CTaskServer::RequestShutdown(), s_JoinAllThreads(), s_MainThr, s_PerJiffyTasks_Main(), s_StartAllThreads(), and s_Threads.
Referenced by CTaskServer::Run().
void WriteSetup_Threads | ( | CSrvSocketTask & | task | ) |
Definition at line 455 of file threads_man.cpp.
References s_MaxRunningThreads, CSrvSocketTask::WriteNumber(), and CSrvSocketTask::WriteText().
Referenced by CTaskServer::WriteSetup().