m_LifeSpan(
int(span) + adjust)
66 if(adjust >= 5000 || adjust <= -5000) {
68<<
"CSafeStaticLifeSpan level adjustment out of range: " 71 _ASSERT(adjust > -5000 && adjust < 5000);
95 return int(s_CreationOrder.
Add(1));
115 using TQueue= deque<CSafeStatic<TFunction>>;
150 #if defined(NCBI_WIN32_THREADS) 180*holder = std::move(on_exit);
193 CMutexGuardguard(CSafeStaticPtr_Base::sm_ClassMutex);
210 CMutexGuardguard(CSafeStaticPtr_Base::sm_ClassMutex);
226 string msg=
"On static data destruction, child thread(s) still running: "+ to_string(tc);
242 for(
intpass = 0; pass < 3; ++pass ) {
245 swap(cur_Stack, *stack);
250guard.
Guard(CSafeStaticPtr_Base::sm_ClassMutex);
272 return&sl_CleanupGuard;
void Guard(resource_type &resource)
Manually force the guard to protect some other resource.
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 void Destroy(CSafeStaticLifeSpan::ELifeLevel level)
Explicitly destroy all on-demand variables up to a specified level.
static CSafeStaticGuard * x_Get(void)
static TStack *& x_GetStack(CSafeStaticLifeSpan::ELifeLevel level)
CSafeStaticGuard(void)
Check if already initialized.
static bool sm_ChildThreadsCheck
multiset< CSafeStaticPtr_Base *, CSafeStatic_Less > TStack
static void x_Cleanup(CMutexGuard &guard, TStack *&stack)
~CSafeStaticGuard(void)
Check reference count, and if it is zero, then destroy all registered variables.
static void DisableChildThreadsCheck()
Disable checking on child thread(s) running during destruction.
static CSafeStaticLifeSpan & GetDefault(void)
Get default life span (set to eLifeSpan_Min).
ELifeSpan
Predefined life spans for the safe static objects.
@ eLifeSpan_Min
std static, not adjustable
CSafeStaticLifeSpan(ELifeSpan span, int adjust=0)
Constructs a life span object from basic level and adjustment.
ELifeLevel
Predefined life levels for the safe static objects.
@ eLifeLevel_AppMain
Destroyed in CNcbiApplication::AppMain, if possible.
static int x_GetCreationOrder(void)
bool x_IsStdStatic(void) const
~CSafeStaticPtr_Base(void)
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
TValue Add(int delta) THROWS_NONE
Atomically add value (=delta), and return new counter value.
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
void Error(CExceptionArgs_Base &args)
void Warning(CExceptionArgs_Base &args)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static unsigned int GetThreadsCount()
Get total amount of threads This amount does not contain main thread.
unsigned int
A callback function used to compare two keys in a database.
Definition of all error codes used in corelib (xncbi.lib).
static CSafeStaticGuard * sh_CleanupGuard
static CSafeStaticGuard sg_CleanupGuard
DEFINE_CLASS_STATIC_MUTEX(CSafeStaticPtr_Base::sm_ClassMutex)
Static variables safety - create on demand, destroy on application termination.
Multi-threading â mutexes; rw-locks; semaphore.
Multi-threading â classes, functions, and features.
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
function< void()> TFunction
deque< CSafeStatic< TFunction > > TQueue
static void CallAndReset(TFunction &func)
static TQueue *& GetQueue()
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