mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 17:05:55 +08:00
Implemented a Watchdog class. Do not manually create Thread objects anymore, use Watchdog.StartThread(). While your thread is running call Watchdog.UpdateThread(). When it is shutting down call Watchdog.RemoveThread(). Most of the threads in OpenSim have been updated
This commit is contained in:
@@ -67,9 +67,8 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||
{
|
||||
m_client = client;
|
||||
m_scene = scene;
|
||||
|
||||
Thread loopThread = new Thread(InternalLoop);
|
||||
loopThread.Start();
|
||||
|
||||
Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false);
|
||||
}
|
||||
|
||||
private void SendServerCommand(string command)
|
||||
@@ -102,7 +101,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||
{
|
||||
try
|
||||
{
|
||||
string strbuf = "";
|
||||
string strbuf = String.Empty;
|
||||
|
||||
while (m_connected && m_client.Connected)
|
||||
{
|
||||
@@ -140,6 +139,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||
}
|
||||
|
||||
Thread.Sleep(0);
|
||||
Watchdog.UpdateThread();
|
||||
}
|
||||
}
|
||||
catch (IOException)
|
||||
@@ -156,6 +156,8 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||
|
||||
m_log.Warn("[IRCd] Disconnected client.");
|
||||
}
|
||||
|
||||
Watchdog.RemoveThread();
|
||||
}
|
||||
|
||||
private void ProcessInMessage(string message, string command)
|
||||
|
||||
@@ -33,6 +33,7 @@ using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||
@@ -56,8 +57,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||
|
||||
m_listener.Start(50);
|
||||
|
||||
Thread thread = new Thread(ListenLoop);
|
||||
thread.Start();
|
||||
Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false);
|
||||
m_baseScene = baseScene;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,10 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||
while (m_running)
|
||||
{
|
||||
AcceptClient(m_listener.AcceptTcpClient());
|
||||
Watchdog.UpdateThread();
|
||||
}
|
||||
|
||||
Watchdog.RemoveThread();
|
||||
}
|
||||
|
||||
private void AcceptClient(TcpClient client)
|
||||
|
||||
Reference in New Issue
Block a user