Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Foundation/Debug/Main.cpp
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#include "Stroika/Foundation/StroikaPreComp.h"
5
6#include "Main.h"
7
8using namespace Stroika::Foundation;
9
10namespace {
11 /*
12 * This wont work 100% of the time, but try to detect threads running before main, or after the end of main ()
13 */
14 bool sKnownBadBeforeMainOrAfterMain_{true};
15 struct MainDetector_ {
16 MainDetector_ ()
17 {
18 sKnownBadBeforeMainOrAfterMain_ = false;
19 }
20 ~MainDetector_ ()
21 {
22 sKnownBadBeforeMainOrAfterMain_ = true;
23 }
24 };
25 MainDetector_ sMainDetector_;
26}
27
28/*
29 ********************************************************************************
30 ************************ Debug::AppearsDuringMainLifetime **********************
31 ********************************************************************************
32 */
33bool Debug::AppearsDuringMainLifetime ()
34{
35 return not sKnownBadBeforeMainOrAfterMain_;
36}