mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 01:35:46 +08:00
test: try handle cntr-c another way
This commit is contained in:
@@ -61,10 +61,6 @@ namespace OpenSim.Server.Base
|
||||
//
|
||||
private bool m_Running = true;
|
||||
|
||||
#if (_MONO)
|
||||
private static Mono.Unix.UnixSignal[] signals;
|
||||
#endif
|
||||
|
||||
// Handle all the automagical stuff
|
||||
//
|
||||
public ServicesServerBase(string prompt, string[] args) : base()
|
||||
@@ -179,42 +175,6 @@ namespace OpenSim.Server.Base
|
||||
RegisterCommonCommands();
|
||||
RegisterCommonComponents(Config);
|
||||
|
||||
#if (_MONO)
|
||||
Thread signal_thread = new Thread (delegate ()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
// Wait for a signal to be delivered
|
||||
int index = Mono.Unix.UnixSignal.WaitAny (signals, -1);
|
||||
|
||||
//Mono.Unix.Native.Signum signal = signals [index].Signum;
|
||||
ShutdownSpecific();
|
||||
m_Running = false;
|
||||
Environment.Exit(0);
|
||||
}
|
||||
});
|
||||
|
||||
if(!Util.IsWindows())
|
||||
{
|
||||
try
|
||||
{
|
||||
// linux mac os specifics
|
||||
signals = new Mono.Unix.UnixSignal[]
|
||||
{
|
||||
new Mono.Unix.UnixSignal(Mono.Unix.Native.Signum.SIGTERM)
|
||||
};
|
||||
ignal_thread.IsBackground = true;
|
||||
signal_thread.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Info("Could not set up UNIX signal handlers. SIGTERM will not");
|
||||
m_log.InfoFormat("shut down gracefully: {0}", e.Message);
|
||||
m_log.Debug("Exception was: ", e);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Allow derived classes to perform initialization that
|
||||
// needs to be done after the console has opened
|
||||
Initialise();
|
||||
@@ -225,6 +185,8 @@ namespace OpenSim.Server.Base
|
||||
get { return m_Running; }
|
||||
}
|
||||
|
||||
private bool DoneShutdown = false;
|
||||
|
||||
public virtual int Run()
|
||||
{
|
||||
Watchdog.Enabled = true;
|
||||
@@ -242,13 +204,16 @@ namespace OpenSim.Server.Base
|
||||
}
|
||||
}
|
||||
|
||||
MainServer.Stop();
|
||||
|
||||
MemoryWatchdog.Enabled = false;
|
||||
Watchdog.Enabled = false;
|
||||
WorkManager.Stop();
|
||||
RemovePIDFile();
|
||||
if (!DoneShutdown)
|
||||
{
|
||||
DoneShutdown = true;
|
||||
MainServer.Stop();
|
||||
|
||||
MemoryWatchdog.Enabled = false;
|
||||
Watchdog.Enabled = false;
|
||||
WorkManager.Stop();
|
||||
RemovePIDFile();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -260,6 +225,20 @@ namespace OpenSim.Server.Base
|
||||
m_log.Info("[CONSOLE] Quitting");
|
||||
|
||||
base.ShutdownSpecific();
|
||||
|
||||
if (!DoneShutdown)
|
||||
{
|
||||
DoneShutdown = true;
|
||||
MainServer.Stop();
|
||||
|
||||
MemoryWatchdog.Enabled = false;
|
||||
Watchdog.Enabled = false;
|
||||
WorkManager.Stop();
|
||||
RemovePIDFile();
|
||||
Util.StopThreadPool();
|
||||
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void ReadConfig()
|
||||
|
||||
Reference in New Issue
Block a user