NCBI C++ ToolKit
Classes | Macros | Typedefs | Functions | Variables
ncbithr.cpp File Reference
#include <ncbi_pch.hpp>
#include <corelib/ncbi_param.hpp>
#include <corelib/request_ctx.hpp>
#include <corelib/ncbi_system.hpp>
#include <corelib/error_codes.hpp>
#include <sys/time.h>
#include "ncbidbg_p.hpp"
+ Include dependency graph for ncbithr.cpp:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

struct  SNativeThreadTlsCleanup
 
class  CExitThreadException
 

Macros

#define NCBI_USE_ERRCODE_X   Corelib_Threads
 
#define NCBI_THREAD_VALIDATE(cond, error_code, message)    if ( !(cond) ) NCBI_THROW(CThreadException, error_code, message)
 

Typedefs

typedef TWrapperRes(* FSystemWrapper) (TWrapperArg)
 

Functions

 DEFINE_STATIC_MUTEX (s_TlsCleanupMutex)
 
static void s_CleanupUsedTlsBases (CUsedTlsBases *tls, void *)
 
static void s_CleanupMainUsedTlsBases (CUsedTlsBases &tls)
 
void s_TlsSetValue (TTlsKey &key, void *data, const char *err_message)
 
 DEFINE_STATIC_FAST_MUTEX (s_ThreadMutex)
 
static DECLARE_TLS_VAR (CThread *, sx_ThreadPtr)
 
static DECLARE_TLS_VAR (CThread::TID, sx_ThreadId)
 
 DEFINE_STATIC_FAST_MUTEX (s_MainThreadIdMutex)
 
CThread::TID sx_GetMainThreadId ()
 
void sx_SetMainThreadId (CThread::TID id)
 
static int sx_GetNextThreadId (void)
 
 NCBI_PARAM_DECL (bool, Thread, Catch_Unhandled_Exceptions)
 
 NCBI_PARAM_DEF_EX (bool, Thread, Catch_Unhandled_Exceptions, true, 0, THREAD_CATCH_UNHANDLED_EXCEPTIONS)
 
typedef NCBI_PARAM_TYPE (Thread, Catch_Unhandled_Exceptions) TParamThreadCatchExceptions
 
TWrapperRes ThreadWrapperCaller (TWrapperArg arg)
 
static TWrapperRes ThreadWrapperCallerImpl (TWrapperArg arg)
 
 NCBI_PARAM_DECL (size_t, Thread, StackSize)
 
 NCBI_PARAM_DEF_EX (size_t, Thread, StackSize, 2048 *1024, eParam_NoThread, THREAD_STACK_SIZE)
 
typedef NCBI_PARAM_TYPE (Thread, StackSize) TParamThreadStackSize
 

Variables

static CSafeStatic< CUsedTlsBasess_MainUsedTlsBases (0, s_CleanupMainUsedTlsBases, CSafeStaticLifeSpan::eLifeSpan_Long)
 
static bool sm_MainThreadIdInitialized = false
 
static const CThread::TID kMainThreadId = ~CThread::TID(0)
 
static CThread::TID sx_MainThreadId = kMainThreadId
 

Macro Definition Documentation

◆ NCBI_THREAD_VALIDATE

#define NCBI_THREAD_VALIDATE (   cond,
  error_code,
  message 
)     if ( !(cond) ) NCBI_THROW(CThreadException, error_code, message)

Definition at line 714 of file ncbithr.cpp.

◆ NCBI_USE_ERRCODE_X

#define NCBI_USE_ERRCODE_X   Corelib_Threads

Definition at line 59 of file ncbithr.cpp.

Typedef Documentation

◆ FSystemWrapper

typedef TWrapperRes(* FSystemWrapper) (TWrapperArg)

Definition at line 679 of file ncbithr.cpp.

Function Documentation

◆ DECLARE_TLS_VAR() [1/2]

static DECLARE_TLS_VAR ( CThread ,
sx_ThreadPtr   
)
static

◆ DECLARE_TLS_VAR() [2/2]

static DECLARE_TLS_VAR ( CThread::TID  ,
sx_ThreadId   
)
static

◆ DEFINE_STATIC_FAST_MUTEX() [1/2]

DEFINE_STATIC_FAST_MUTEX ( s_MainThreadIdMutex  )

◆ DEFINE_STATIC_FAST_MUTEX() [2/2]

DEFINE_STATIC_FAST_MUTEX ( s_ThreadMutex  )

◆ DEFINE_STATIC_MUTEX()

DEFINE_STATIC_MUTEX ( s_TlsCleanupMutex  )

◆ NCBI_PARAM_DECL() [1/2]

NCBI_PARAM_DECL ( bool  ,
Thread  ,
Catch_Unhandled_Exceptions   
)

◆ NCBI_PARAM_DECL() [2/2]

NCBI_PARAM_DECL ( size_t  ,
Thread  ,
StackSize   
)

◆ NCBI_PARAM_DEF_EX() [1/2]

NCBI_PARAM_DEF_EX ( bool  ,
Thread  ,
Catch_Unhandled_Exceptions  ,
true  ,
,
THREAD_CATCH_UNHANDLED_EXCEPTIONS   
)

◆ NCBI_PARAM_DEF_EX() [2/2]

NCBI_PARAM_DEF_EX ( size_t  ,
Thread  ,
StackSize  ,
2048 *  1024,
eParam_NoThread  ,
THREAD_STACK_SIZE   
)

◆ NCBI_PARAM_TYPE() [1/2]

typedef NCBI_PARAM_TYPE ( Thread  ,
Catch_Unhandled_Exceptions   
)

◆ NCBI_PARAM_TYPE() [2/2]

typedef NCBI_PARAM_TYPE ( Thread  ,
StackSize   
)

◆ s_CleanupMainUsedTlsBases()

static void s_CleanupMainUsedTlsBases ( CUsedTlsBases tls)
static

Definition at line 137 of file ncbithr.cpp.

References CUsedTlsBases::ClearAll().

◆ s_CleanupUsedTlsBases()

static void s_CleanupUsedTlsBases ( CUsedTlsBases tls,
void *   
)
static

Definition at line 132 of file ncbithr.cpp.

Referenced by CUsedTlsBases::GetUsedTlsBases().

◆ s_TlsSetValue()

void s_TlsSetValue ( TTlsKey key,
void *  data,
const char *  err_message 
)
inline

◆ sx_GetMainThreadId()

CThread::TID sx_GetMainThreadId ( )

Definition at line 449 of file ncbithr.cpp.

References sx_MainThreadId.

Referenced by CThread::IsMain().

◆ sx_GetNextThreadId()

static int sx_GetNextThreadId ( void  )
static

Definition at line 463 of file ncbithr.cpp.

Referenced by CThread::GetSelf(), and CThread::x_InitializeThreadId().

◆ sx_SetMainThreadId()

void sx_SetMainThreadId ( CThread::TID  id)

Definition at line 456 of file ncbithr.cpp.

References sx_MainThreadId.

◆ ThreadWrapperCaller()

TWrapperRes ThreadWrapperCaller ( TWrapperArg  arg)
inline

Definition at line 673 of file ncbithr.cpp.

References CThread::Wrapper().

Referenced by ThreadWrapperCallerImpl().

◆ ThreadWrapperCallerImpl()

static TWrapperRes ThreadWrapperCallerImpl ( TWrapperArg  arg)
static

Definition at line 681 of file ncbithr.cpp.

References ThreadWrapperCaller().

Referenced by CThread::Run().

Variable Documentation

◆ kMainThreadId

const CThread::TID kMainThreadId = ~CThread::TID(0)
static

Definition at line 443 of file ncbithr.cpp.

Referenced by CThread::GetSelf(), and CThread::InitializeMainThreadId().

◆ s_MainUsedTlsBases

◆ sm_MainThreadIdInitialized

bool sm_MainThreadIdInitialized = false
static

Definition at line 442 of file ncbithr.cpp.

Referenced by CThread::GetSelf(), CThread::InitializeMainThreadId(), and CThread::IsMain().

◆ sx_MainThreadId

CThread::TID sx_MainThreadId = kMainThreadId
static
Modified on Wed Feb 28 07:13:50 2024 by modify_doxy.py rev. 669887