diff options
author | click <none@none> | 2010-04-19 18:15:41 +0200 |
---|---|---|
committer | click <none@none> | 2010-04-19 18:15:41 +0200 |
commit | ed2e64af4c85c192626e410ac4719a32a4cd068c (patch) | |
tree | 3e43de215fb9cb2d84354194d2605ee111c2343b /src/trinitycore | |
parent | 450c6af43bd18b42dc9475befa062d51f04a946c (diff) |
Add snippet to fix thread-hangs-on-exit on server exit
Closes issue #842
--HG--
branch : trunk
Diffstat (limited to 'src/trinitycore')
-rw-r--r-- | src/trinitycore/CliRunnable.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
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 |