fix: make exception handler be singleton in same process.

- use CreateMutexW to make sure exception handler is singleton in the same process.
	- Because one process may load multiple DLLs using YYCC.
	- According to this, it will produce N times error log. N is the count of DLLs using YYCC exception handler.
- refactor exception handler. use a class instance to manage all global variables and add a std::mutex to let module be thread safe.
- change the way of check in console input testbench.
This commit is contained in:
2024-07-07 17:29:26 +08:00
parent 3075ec583d
commit 4f1e2447d0
2 changed files with 172 additions and 63 deletions

View File

@ -134,7 +134,8 @@ namespace YYCCTestbench {
Console::Write(YYCC_U8("\t> "));
YYCC::yycc_u8string gotten(Console::ReadLine());
Assert(gotten == strl, YYCC::StringHelper::Printf(YYCC_U8("Got: %s"), gotten.c_str()).c_str());
if (gotten == strl) Console::FormatLine(YYCC_U8(YYCC_COLOR_LIGHT_GREEN("\tMatched! Got: %s")), gotten.c_str());
else Console::FormatLine(YYCC_U8(YYCC_COLOR_LIGHT_RED("\tNOT Matched! Got: %s")), gotten.c_str());
}
}