Browse Source

add some usefull outputs

Kolja Strohm 2 years ago
parent
commit
bad613fef0

+ 1 - 0
FactoryCraft/Game.cpp

@@ -454,6 +454,7 @@ void Game::thread()
     generator->exitAndWait();
     loader->exitAndWait();
     ticker->exitAndWait();
+    std::cout << "Game thread exited\n";
 }
 
 void Game::api(Framework::InMemoryBuffer* zRequest, GameClient* zOrigin)

+ 10 - 3
FactoryCraft/TickWorker.cpp

@@ -1,5 +1,8 @@
 #include "TickWorker.h"
 
+#include <sys/syscall.h>
+#include <unistd.h>
+
 #include "Block.h"
 
 TickWorker::TickWorker(TickQueue* queue)
@@ -10,8 +13,7 @@ TickWorker::TickWorker(TickQueue* queue)
     start();
 }
 
-TickWorker::~TickWorker()
-{}
+TickWorker::~TickWorker() {}
 
 void TickWorker::thread()
 {
@@ -21,7 +23,12 @@ void TickWorker::thread()
         zTick->tick(queue);
         zTick = queue->zNext(waiting);
     }
-    std::cout << "exiting tick worker " << GetThreadId(this->getThreadHandle());
+    // do not use multiple << here because they are not printed at once with
+    // multiple threads
+    pid_t tid;
+    tid = syscall(SYS_gettid);
+    Framework::Text txt = Framework::Text("exiting tick worker ") + tid + "\n";
+    std::cout << txt.getText();
 }
 
 bool TickWorker::isWaiting() const

+ 1 - 0
FactoryCraft/WorldGenerator.cpp

@@ -72,6 +72,7 @@ void WorldGenerator::thread()
             }
         }
     }
+    std::cout << "World Generator thread exited\n";
 }
 
 void WorldGenerator::requestGeneration(Area request)

+ 1 - 0
FactoryCraft/WorldLoader.cpp

@@ -108,6 +108,7 @@ void WorldLoader::thread()
             }
         }
     }
+    std::cout << "World Loader thread exited\n";
 }
 
 void WorldLoader::requestLoading(Area request)