[6830] Implement custom exit codes on server shutdown/restart

Added the possibility to use custom process return values
instead of hardcoded 0 (shutdown) or 2 (restart) to allow using them
for various custom external features / better handling.

This can be used through 4 commands in ".server" family:
 - shutdown
 - restart
 - idleshutdown
 - idlerestart

Those have from now on 2 arguments, where the second (return value)
is optional:

.server <command> <time> [return_value]

If return_value is not specified, default value (0 or 2) is used.

Signed-off-by: freghar <compmancz@gmail.com>

Set restart exist code for SIGINT singnal case.
Some code simplifications for original patch.
Related code cleanups.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
freghar 2008-11-12 21:09:56 +01:00 committed by VladimirMangos
parent 3d72b06fcd
commit 528a9d830a
8 changed files with 149 additions and 49 deletions

View file

@ -49,7 +49,7 @@ void WorldRunnable::run()
uint32 prevSleepTime = 0; // used for balanced full tick time length near WORLD_SLEEP_CONST
///- While we have not World::m_stopEvent, update the world
while (!World::m_stopEvent)
while (!World::IsStopped())
{
++World::m_worldLoopCounter;
realCurrTime = getMSTime();