fix: IntraIOManager batch thread + AutoCompiler Windows support

- Re-enable batch flush thread for low-frequency message batching
- Fix JSON type error in routing stats logging (.get<size_t>())
- Add Windows/MinGW support to AutoCompiler (mingw32-make, NUL)
- Fix TankModule.h linter merge bug (add comment between lines)
- Add Windows platform check for make command in test_01

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
StillHammer 2025-12-31 09:44:37 +07:00
parent edf4d76844
commit 415cad1b0a
4 changed files with 579 additions and 559 deletions

View File

@ -14,26 +14,26 @@ IntraIOManager::IntraIOManager() {
logger->info("🌐🔗 IntraIOManager created - Central message router initialized");
// TEMPORARY: Disable batch thread to debug Windows crash
batchThreadRunning = false;
// batchThread = std::thread(&IntraIOManager::batchFlushLoop, this);
batchThreadRunning = true;
batchThread = std::thread(&IntraIOManager::batchFlushLoop, this);
logger->info("⚠️ Batch flush thread DISABLED (debugging Windows crash)");
}
IntraIOManager::~IntraIOManager() {
// Stop batch thread first
batchThreadRunning = false;
// TEMPORARY: Thread disabled for debugging
// if (batchThread.joinable()) {
// batchThread.join();
// }
logger->info("🛑 Batch flush thread stopped (was disabled)");
// Join the batch thread
if (batchThread.joinable()) {
batchThread.join();
}
logger->info("🛑 Batch flush thread stopped");
// Get stats before locking to avoid recursive lock
auto stats = getRoutingStats();
logger->info("📊 Final routing stats:");
logger->info(" Total routed messages: {}", stats["total_routed_messages"]);
logger->info(" Total routes: {}", stats["total_routes"]);
logger->info(" Active instances: {}", stats["active_instances"]);
logger->info(" Total routed messages: {}", stats["total_routed_messages"].get<size_t>());
logger->info(" Total routes: {}", stats["total_routes"].get<size_t>());
logger->info(" Active instances: {}", stats["active_instances"].get<size_t>());
{
std::unique_lock lock(managerMutex); // WRITE - exclusive access needed

View File

@ -85,12 +85,19 @@ bool AutoCompiler::compile(int iteration) {
std::this_thread::sleep_for(std::chrono::milliseconds(10));
// Build the module using make
#ifdef _WIN32
std::string makeCmd = "mingw32-make";
std::string nullDev = "NUL";
#else
std::string makeCmd = "make";
std::string nullDev = "/dev/null";
#endif
// Note: Tests run from build/tests/, so we use make -C .. to build from build directory
std::string command;
if (buildDir_ == "build") {
command = "make -C .. " + moduleName_ + " > /dev/null 2>&1";
command = makeCmd + " -C .. " + moduleName_ + " > " + nullDev + " 2>&1";
} else {
command = "make -C " + buildDir_ + " " + moduleName_ + " > /dev/null 2>&1";
command = makeCmd + " -C " + buildDir_ + " " + moduleName_ + " > " + nullDev + " 2>&1";
}
int result = std::system(command.c_str());

View File

@ -125,7 +125,13 @@ int main() {
// Recompiler
std::cout << " 2. Recompiling module...\n";
// Note: This test runs from build/tests/, so we use make -C .. to build from build directory
int buildResult = system("make -C .. TankModule 2>&1 > /dev/null");
int buildResult = system(
#ifdef _WIN32
"mingw32-make -C .. TankModule 2>&1 > NUL"
#else
"make -C .. TankModule 2>&1 > /dev/null"
#endif
);
if (buildResult != 0) {
std::cerr << "❌ Compilation failed!\n";
return 1;
@ -259,7 +265,13 @@ int main() {
outputRestore.close();
// Rebuild to restore original version (test runs from build/tests/)
system("make -C .. TankModule 2>&1 > /dev/null");
system(
#ifdef _WIN32
"mingw32-make -C .. TankModule 2>&1 > NUL"
#else
"make -C .. TankModule 2>&1 > /dev/null"
#endif
);
// === RAPPORTS ===
std::cout << "\n";

View File

@ -32,7 +32,8 @@ public:
private:
std::vector<Tank> tanks;
int frameCount = 0;
std::string moduleVersion = "v2.0 HOT-RELOADED";:shared_ptr<spdlog::logger> logger;
std::string moduleVersion = "v2.0 HOT-RELOADED"; // Module logging
std::shared_ptr<spdlog::logger> logger;
std::unique_ptr<IDataNode> config;
void updateTank(Tank& tank, float dt);