NCBI C++ ToolKit
|
#include "task_server_pch.hpp"
#include <corelib/ncbireg.hpp>
#include "threads_man.hpp"
#include "timers.hpp"
#include "sockets_man.hpp"
#include "memory_man.hpp"
#include "logging.hpp"
#include "time_man.hpp"
#include "server_core.hpp"
#include "rcu.hpp"
#include "scheduler.hpp"
#include "srv_stat.hpp"
Go to the source code of this file.
Go to the SVN repository for this file.
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().
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().
|
static |
Definition at line 225 of file threads_man.cpp.
References AssignThreadLogging(), AssignThreadMemMgr(), AssignThreadSched(), AssignThreadSocks(), s_Threads, SSrvThread::stat, and SSrvThread::thread_num.
Referenced by InitThreadsMan().
|
static |
Definition at line 414 of file threads_man.cpp.
References eThreadReleased, i, NULL, RCUFinalizeThread(), ReleaseThreadLogging(), s_MainThr, s_MaxRunningThreads, s_SvcThr, s_Threads, and thr.
Referenced by RunMainThread().
|
static |
Definition at line 146 of file threads_man.cpp.
References CheckLoggingFlush(), CSrvTime::CurSecs(), CTaskServer::IsInShutdown(), RCUPassQS(), s_CurJiffies, and thr.
Referenced by RunMainThread().
|
static |
Definition at line 165 of file threads_man.cpp.
References CheckLoggingFlush(), CSrvTime::CurSecs(), CTaskServer::IsInShutdown(), RCUPassQS(), s_CurJiffies, SchedCheckOverloads(), thr, and TimerTick().
Referenced by s_ServiceThreadMain().
|
static |
Definition at line 186 of file threads_man.cpp.
References CheckConnectsTimeout(), CheckLoggingFlush(), CleanSocketList(), CSrvTime::CurSecs(), eThreadLockedForStop, eThreadStopped, eThrMgrSocksMoved, eThrMgrThreadExited, CTaskServer::IsInShutdown(), IsServerStopping(), CMiniMutex::Lock(), MoveAllSockets(), PromoteSockAmount(), RCUHasCalls(), RCUPassQS(), s_CurJiffies, s_CurMgrThread, s_SrvState, s_ThreadMgrState, s_ThrMgrLock, SchedStartJiffy(), SetAllSocksRunnable(), SSrvThread::socks, thr, and CMiniMutex::Unlock().
Referenced by s_WorkerThreadMain().
|
static |
Definition at line 129 of file threads_man.cpp.
References eThreadRunning, eThrMgrIdle, eThrMgrStarting, CMiniMutex::Lock(), NULL, s_CurMgrThread, s_SetCurThread(), s_ThreadMgrState, s_ThrMgrLock, SRV_FATAL, thr, and CMiniMutex::Unlock().
Referenced by s_WorkerThreadMain().
|
static |
Definition at line 316 of file threads_man.cpp.
References CSrvTime::Current(), eThrMgrNeedNewThread, eThrMgrSocksMoved, IncCurJiffies(), CTaskServer::IsInShutdown(), IsServerStopping(), NULL, SSrvThread::rcu, RCUFinalizeThread(), RCUHasCalls(), RCUInitNewThread(), s_JiffyTime, s_LastJiffyTime, s_PerJiffyTasks_Service(), s_SetCurThread(), s_StartCurMgrThread(), s_StopCurMgrThread(), s_SvcSignal, s_SvcThr, s_ThreadMgrState, TrackShuttingDown(), and CFutex::WaitValueChange().
Referenced by s_StartAllThreads().
|
static |
Definition at line 113 of file threads_man.cpp.
References buf, eThreadDormant, s_AppBaseName, and thr.
Referenced by InitThreadsMan(), s_RegisterNewThread(), and s_ServiceThreadMain().
Definition at line 396 of file threads_man.cpp.
References eThreadReleased, i, LogNoteThreadsStarted(), s_MaxRunningThreads, s_ServiceThreadMain(), s_StartThread(), s_SvcThr, s_Threads, s_WorkerThreadMain(), and SSrvThread::thread_state.
Referenced by RunMainThread().
|
static |
Definition at line 300 of file threads_man.cpp.
References eThreadReleased, eThrMgrIdle, eThrMgrStarting, CMiniMutex::Lock(), NULL, s_CurMgrThread, s_StartThread(), s_ThreadMgrState, s_ThrMgrLock, s_WorkerThreadMain(), StartThreadLogging(), SSrvThread::thread_state, and CMiniMutex::Unlock().
Referenced by s_ServiceThreadMain().
|
static |
Definition at line 264 of file threads_man.cpp.
References Critical(), NULL, SRV_LOG, and thr.
Referenced by s_StartAllThreads(), and s_StartCurMgrThread().
|
static |
Definition at line 277 of file threads_man.cpp.
References Critical(), eThreadReleased, eThrMgrIdle, CMiniMutex::Lock(), NULL, ReleaseThreadMemMgr(), ReleaseThreadSched(), ReleaseThreadSocks(), s_CurMgrThread, s_ThreadMgrState, s_ThrMgrLock, SRV_LOG, SSrvThread::stat, StopThreadLogging(), SSrvThread::thread_state, CSrvStat::ThreadStopped(), and CMiniMutex::Unlock().
Referenced by s_ServiceThreadMain().
|
static |
Definition at line 239 of file threads_man.cpp.
References data, eThreadStopped, eThrMgrPreparesToStop, eThrMgrThreadExited, IsServerStopping(), CMiniMutex::Lock(), NULL, RCUFinalizeThread(), RCUInitNewThread(), s_CurMgrThread, s_PerJiffyTasks_Worker(), s_RegisterNewThread(), s_ThreadMgrState, s_ThrMgrLock, SchedExecuteTask(), SRV_FATAL, thr, and CMiniMutex::Unlock().
Referenced by s_StartAllThreads(), and s_StartCurMgrThread().
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().
|
static |
Definition at line 55 of file threads_man.cpp.
Referenced by ConfigureThreads().
|
extern |
Definition at line 77 of file server_core.cpp.
Referenced by GetConfName(), s_LoadConfFile(), s_ProcessParameters(), and s_SetCurThread().
|
extern |
Definition at line 53 of file time_man.cpp.
Referenced by IncCurJiffies(), s_PerJiffyTasks_Main(), s_PerJiffyTasks_Service(), and s_PerJiffyTasks_Worker().
|
static |
Definition at line 62 of file threads_man.cpp.
Referenced by RequestThreadRevive(), RequestThreadStart(), RequestThreadStop(), s_PerJiffyTasks_Worker(), s_RegisterNewThread(), s_StartCurMgrThread(), s_StopCurMgrThread(), and s_WorkerThreadMain().
|
extern |
Definition at line 54 of file time_man.cpp.
Referenced by ConfigureTimeMan(), s_ServiceThreadMain(), and WriteSetup_TimeMan().
|
static |
Definition at line 63 of file threads_man.cpp.
Referenced by InitThreadsMan(), RunMainThread(), and s_JoinAllThreads().
TSrvThreadNum s_MaxRunningThreads = 20 |
Definition at line 71 of file threads_man.cpp.
Referenced by CSrvStat::CollectThreads(), ConfigureThreads(), GetCntRunningThreads(), CTaskServer::GetCurThreadNum(), CTaskServer::GetMaxRunningThreads(), InitThreadsMan(), CSrvStat::PrintToSocket(), s_FindQueueThread(), s_FindRebalanceTasks(), s_JoinAllThreads(), s_StartAllThreads(), SchedCheckOverloads(), SchedIsAllIdle(), CDiagContext::UpdatePID(), and WriteSetup_Threads().
|
static |
Definition at line 69 of file threads_man.cpp.
Referenced by s_ServiceThreadMain().
|
static |
Definition at line 64 of file threads_man.cpp.
Referenced by InitThreadsMan(), s_JoinAllThreads(), s_ServiceThreadMain(), and s_StartAllThreads().
|
static |
Definition at line 61 of file threads_man.cpp.
Referenced by RequestThreadRevive(), RequestThreadStart(), RequestThreadStop(), s_PerJiffyTasks_Worker(), s_RegisterNewThread(), s_ServiceThreadMain(), s_StartCurMgrThread(), s_StopCurMgrThread(), and s_WorkerThreadMain().
SSrvThread** s_Threads = NULL |
Definition at line 59 of file threads_man.cpp.
Referenced by CSrvStat::CollectThreads(), GetCntRunningThreads(), InitThreadsMan(), RunMainThread(), s_AddTaskToQueue(), s_AllocThread(), s_FindQueueThread(), s_FindRebalanceTasks(), s_JoinAllThreads(), s_ProcessListenEvent(), s_StartAllThreads(), SchedCheckOverloads(), SchedIsAllIdle(), SchedStartJiffy(), and CDiagContext::UpdatePID().
|
static |
Definition at line 60 of file threads_man.cpp.
Referenced by RequestThreadRevive(), RequestThreadStart(), RequestThreadStop(), s_PerJiffyTasks_Worker(), s_RegisterNewThread(), s_StartCurMgrThread(), s_StopCurMgrThread(), and s_WorkerThreadMain().