src/app/netcache/nc_utils.cpp File Reference

#include <ncbi_pch.hpp>
#include <corelib/ncbiatomic.hpp>
#include "nc_utils.hpp"

Include dependency graph for nc_utils.cpp:

Go to the source code of this file.

Functions

void g_InitNCThreadIndexes (void)
 Initialize system that will acquire thread indexes for each thread.
TNCThreadIndex g_GetNCThreadIndex (void)
 Get index of the current thread.

Variables

static TNCTlsKey s_NCThreadIndexKey
 TLS key for storing index of the current thread.
static CAtomicCounter s_NextThreadIndex
 Next available thread index.
 END_NCBI_SCOPE


Function Documentation

TNCThreadIndex g_GetNCThreadIndex void   ) 
 

Get index of the current thread.

All threads are indexed with incrementing numbers starting from 1. Thread is indexed only when this function is called and if it wasn't indexed yet.

Definition at line 51 of file nc_utils.cpp.

References CAtomicCounter::Add(), NCTlsGet, NCTlsSet, s_NCThreadIndexKey, and s_NextThreadIndex.

Referenced by CNCServerStat_Getter::CreateTlsObject(), CNCMMSizePool_Getter::CreateTlsObject(), CNCMMChainsPool_Getter::CreateTlsObject(), CNCMMChunksPool_Getter::CreateTlsObject(), CNCMMStats_Getter::CreateTlsObject(), and CNCDBStat::CreateTlsObject().

void g_InitNCThreadIndexes void   ) 
 

Initialize system that will acquire thread indexes for each thread.

This function must be called before g_GetNCThreadIndex() is used.

Definition at line 44 of file nc_utils.cpp.

References NCTlsCreate, s_NCThreadIndexKey, s_NextThreadIndex, and CAtomicCounter::Set().


Variable Documentation

END_NCBI_SCOPE
 

Definition at line 65 of file nc_utils.cpp.

TNCTlsKey s_NCThreadIndexKey [static]
 

TLS key for storing index of the current thread.

Definition at line 36 of file nc_utils.cpp.

Referenced by g_GetNCThreadIndex(), and g_InitNCThreadIndexes().

CAtomicCounter s_NextThreadIndex [static]
 

Next available thread index.

Definition at line 41 of file nc_utils.cpp.

Referenced by g_GetNCThreadIndex(), and g_InitNCThreadIndexes().


Generated on Mon Dec 7 07:23:39 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Mon Dec 07 16:21:42 2009 by modify_doxy.py rev. 173732