A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/ncbithr_8hpp_source.html below:

NCBI C++ ToolKit: include/corelib/ncbithr.hpp Source File

1 #ifndef CORELIB___NCBITHR__HPP 2 #define CORELIB___NCBITHR__HPP 69  friend class

CStaticTlsHelper;

72  typedef

void (*FCleanupBase)(

void

*

value

,

void

* cleanup_data);

92

: m_AutoDestroy(auto_destroy)

109  void

x_SetValue(

void

*

value

, FCleanupBase

cleanup

,

void

* cleanup_data, ENativeThreadCleanup native);

112  void

x_Reset(

void

);

119  void

x_Destroy(

void

);

136  STlsData

* x_GetTlsData(

void

)

const

;

144  static void

x_CleanupThreadCallback(

void

* ptr);

147  template

<

class

TValue>

164 template

<

class

TValue>

181  return reinterpret_cast<

TValue*

>

(

x_GetValue

());

229 # define DECLARE_TLS_VAR(type, var) NCBI_TLS_VAR type var 246  return A

(

reinterpret_cast<intptr_t>

(p));

249  return reinterpret_cast<const void

*

>

(

intptr_t

(v));

254  return reinterpret_cast<A

*

>

(p);

257  return reinterpret_cast<const void

*

>

(v);

270  _VERIFY

(pthread_key_create(&new_key, 0) == 0);

271

}

while

( !new_key );

272

pthread_setspecific(new_key, 0);

288 # define DECLARE_TLS_VAR(type, var) CSimpleStaticTls<type> var 292 #define NCBI_STATIC_TLS_VIA_SAFE_STATIC_REF 1 294 #if NCBI_STATIC_TLS_VIA_SAFE_STATIC_REF 296 template

<

class

TValue>

316 template

<

class

TValue>

353  template

<

class

TValue>

friend class CStaticTls

;

375

CStaticTlsHelper* this_ptr =

static_cast<

CStaticTlsHelper*

>

(safe_static);

380  if

( user_cleanup ) {

397 template

<

class

TValue>

413

m_SafeHelper(user_cleanup, life_span)

423  if

(!m_SafeHelper.m_Ptr) {

426  return reinterpret_cast<

TValue*

>

(

x_GetValue

());

430  typedef

void (*

FCleanup

)(TValue*

value

,

void

* cleanup_data);

450  if

(!m_SafeHelper.m_Ptr) {

454  reinterpret_cast<

FCleanupBase

>

(

cleanup

), cleanup_data, native);

467  if

(!m_SafeHelper.m_Ptr) {

476 

CStaticTlsHelper m_SafeHelper;

479  void

x_SafeInit(

void

);

503  static void Init

(

void

);

552

fRunCloneRequestContext = 0x200

577  void

Join(

void

** exit_data = 0);

585  static void

Exit(

void

* exit_data);

590  bool

Discard(

void

);

598  typedef unsigned int TID

;

601  static bool

IsMain(

void

);

604  static CThread

* GetCurrentThread(

void

);

613  static unsigned int

GetThreadsCount();

617  static void

SetCurrentThreadName(

const CTempString

&);

623  static void

InitializeMainThreadId(

void

);

632  static void

SetWaitForAllThreadsTimeout(

const CTimeout

& timeout);

636  virtual void

*

Main

(

void

) = 0;

641  virtual void

OnExit(

void

);

663 #if defined NCBI_THREAD_PID_WORKAROUND 667  static TPid

sx_GetThreadPid(

void

);

668  static void

sx_SetThreadPid(

TPid

pid);

674  void

x_InitializeThreadId(

void

);

683  static bool

WaitForAllThreads(

void

);

702  virtual const char

* GetErrCodeString(

void

)

const override

;

734 #if defined(NCBI_WIN32_THREADS) 735

tls_data = TlsGetValue(

m_Key

);

736 #elif defined(NCBI_POSIX_THREADS) 737

tls_data = pthread_getspecific(

m_Key

);

742  return static_cast<STlsData

*

>

(tls_data);

754  return

tls_data ? tls_data->

m_Value

: 0;

763 #if !NCBI_STATIC_TLS_VIA_SAFE_STATIC_REF 764 template

<

class

TValue>

768

m_SafeHelper.Set(

this

);

void Release()

Manually force the resource to be released.

static void Register(CSafeStaticPtr_Base *ptr)

Add new on-demand variable to the cleanup stack.

static CSafeStaticLifeSpan & GetDefault(void)

Get default life span (set to eLifeSpan_Min).

atomic< const void * > m_Ptr

Pointer to the data.

static void sx_SelfCleanup(CSafeStaticPtr_Base *safe_static, TInstanceMutexGuard &guard)

CTls< TValue > & Get(void)

Create the variable if not created yet, return the reference.

CSafeStatic_Callbacks< CTls< CUsedTlsBases > >::FCleanup FCleanup

CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...

CTimeout – Timeout interval.

static void cleanup(void)

#define EXCEPTION_VIRTUAL_BASE

Do not use virtual base classes in exception declaration at all, because in this case derived class s...

virtual void DoDeleteThisObject(void)

Mark this object as allocated in heap – object can be deleted.

CObject & operator=(const CObject &src) THROWS_NONE

Assignment operator.

pid_t TPid

Process identifier (PID) and process handle.

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

void Run(void)

Enter the main loop.

static A * FromVoidP(void *p)

void * m_ExitData

as returned by Main() or passed to Exit()

void * TWrapperArg

Define platform-dependent argument wrapper.

static const void * ToVoidP(A *v)

TThreadHandle m_Handle

platform-dependent thread handle

static const void * ToVoidP(A v)

void(* FUserCleanup)(void *ptr)

static void DefaultCleanup(TValue *value, void *)

bool m_IsTerminated

if Exit() was called for the thread

static A FromVoidP(void *p)

CTlsBase(bool auto_destroy)

Constructor.

TFastMutexGuard CFastMutexGuard

...and backward compatibility

bool m_Initialized

Indicates if thread data initialized.

CSafeStaticLifeSpan TLifeSpan

void(* FCleanup)(TValue *value, void *cleanup_data)

Define cleanup function type, FCleanup.

static bool IsAppExiting(void)

Check if the application is exiting (entered the destructor).

pthread_t TThreadHandle

Define platform-dependent thread handle type.

ERunMode

Which mode should the thread run in.

ENativeThreadCleanup

Flag indicating if cleanup function should be called when using native threads rather than CThread.

ECleanupMode

Flag telling which code has called TLS cleanup.

CStaticTls_Callbacks(FUserCleanup cleanup)

static CTimeout sm_WaitForThreadsTimeout

static CStaticTls< CUsedTlsBases > sm_UsedTlsBases

FCleanupBase m_CleanupFunc

key_type x_GetKey(void) const

void Reset(void)

Reset thread local storage.

void(* FCleanupBase)(void *value, void *cleanup_data)

bool m_IsDetached

if the thread is detached

pthread_key_t TTlsKey

Define internal TLS key type.

void Discard(void)

Discard thread local storage.

const CThread::TID kThreadID_None

set< CTlsBase * > TTlsSet

void x_Init(void)

Initialize thread data.

unsigned int TID

Get ID of current thread.

CStaticTls(FUserCleanup user_cleanup=0, TLifeSpan life_span=TLifeSpan::GetDefault())

CRef< CRequestContext > m_ParentRequestContext

bool m_IsRun

if Run() was called for the thread

bool m_AutoDestroy

Indicates if object should be destroyed in destructor.

void(* FUserCleanup)(void *ptr)

User cleanup function type.

CSafeStatic< CTls< TValue >, CStaticTls_Callbacks< TValue > > TParent

CThread(const CThread &)

Prohibit copying and assigning.

void SetValue(TValue *value, FCleanup cleanup=0, void *cleanup_data=0, ENativeThreadCleanup native=eSkipCleanup)

Set value.

void * x_GetValue(void) const

Helper method to get stored thread data.

NCBI_EXCEPTION_DEFAULT(CThreadException, CException)

bool IsTerminated(void) const

Check if the thread has been terminated.

void x_Reset(void)

Helper method to reset thread data.

virtual void * Main(void)=0

Derived (user-created) class must provide a real thread function.

void x_SetValue(void *value, FCleanupBase cleanup, void *cleanup_data, ENativeThreadCleanup native)

Helper method to set thread data.

void operator=(const value_type &v)

Setter - changes value stored in TLS.

static unsigned int GetThreadsCount()

Get total amount of threads This amount does not contain main thread.

CTls< TValue > * Create()

void SetValue(TValue *value, FCleanup cleanup=0, void *cleanup_data=0, CTlsBase::ENativeThreadCleanup native=CTlsBase::eSkipCleanup)

void * TWrapperRes

Define platform-dependent result wrapper.

int TRunMode

Bitwise OR'd flags for thread creation passed to Run().

pthread_t TThreadSystemID

Define platform-dependent thread ID type.

static atomic< unsigned int > sm_ThreadsCount

Total amount of threads.

bool m_IsJoined

if Join() was called for the thread

CUsedTlsBases(const CUsedTlsBases &)

~CTlsBase(void)

Destructor.

void(* FCleanup)(TValue *value, void *cleanup_data)

Define cleanup function type, FCleanup.

CRef< CThread > m_SelfRef

"this" – to avoid premature destruction

key_type x_GetKeyLong(void) const

#define DEFINE_STATIC_FAST_MUTEX(id)

Define static fast mutex and initialize it.

ENativeThreadCleanup m_Native

STlsData * x_GetTlsData(void) const

Helper method to get the STlsData*.

void Cleanup(CTls< TValue > &value)

TValue * GetValue(void) const

Get the pointer previously stored by SetValue().

TThreadHandle GetThreadHandle()

@ eControlError

Failed to control thread's state.

@ eRunError

Failed to run thread.

@ eCleanup_Toolkit

Cleanup is performed by CThread.

#define NCBI_XNCBI_EXPORT

static unsigned int GetSelf()

const GenericPointer< typename T::ValueType > T2 value

static const char * x_GetValue(const char *svc, size_t svclen, const char *param, char *value, size_t value_size, const char *def_value, int *generic, FStrNCmp strncompar)

Defines process management classes.

Static variables safety - create on demand, destroy on application termination.

TWrapperRes ThreadWrapperCaller(TWrapperArg arg)

Internal structure to store all three pointers in the same TLS.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4