From ed2e64af4c85c192626e410ac4719a32a4cd068c Mon Sep 17 00:00:00 2001 From: click Date: Mon, 19 Apr 2010 18:15:41 +0200 Subject: Add snippet to fix thread-hangs-on-exit on server exit Closes issue #842 --HG-- branch : trunk --- src/trinitycore/CliRunnable.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/trinitycore/CliRunnable.cpp b/src/trinitycore/CliRunnable.cpp index 92923b3a6a4..0fca32e355f 100644 --- a/src/trinitycore/CliRunnable.cpp +++ b/src/trinitycore/CliRunnable.cpp @@ -393,6 +393,15 @@ void CliRunnable::run() { fflush(stdout); + // Safe exit thread + #ifdef linux + while (!kb_hit_return() && !World::IsStopped()) + // With this, we limit CLI to 10commands/second + usleep(100); + if (World::IsStopped()) + break; + #endif + char *command_str ; // = fgets(commandbuf,sizeof(commandbuf),stdin); #if PLATFORM == WINDOWS -- cgit v1.2.3