Removed ThreadPool threads in favour of plain threads.
See NyxStudios/TerrariaAPI-Server@b1d62b6cbd for details.
This commit is contained in:
parent
a7ac433bfa
commit
4eca66a024
4 changed files with 36 additions and 20 deletions
|
|
@ -37,13 +37,21 @@ namespace TShockAPI
|
|||
{
|
||||
initialized = true;
|
||||
serverId = Guid.NewGuid().ToString(); // Gets reset every server restart
|
||||
ThreadPool.QueueUserWorkItem(SendUpdate);
|
||||
// ThreadPool.QueueUserWorkItem(SendUpdate);
|
||||
Thread t = new Thread(() => {
|
||||
do {
|
||||
Thread.Sleep(1000 * 60 * 5);
|
||||
SendUpdate(null);
|
||||
} while(true);
|
||||
});
|
||||
t.IsBackground = true;
|
||||
t.Name = "TShock Stat Tracker Thread";
|
||||
t.Start();
|
||||
}
|
||||
}
|
||||
|
||||
private void SendUpdate(object info)
|
||||
{
|
||||
Thread.Sleep(1000 * 60 * 5);
|
||||
JsonData data;
|
||||
|
||||
if(ServerApi.RunningMono)
|
||||
|
|
@ -105,8 +113,6 @@ namespace TShockAPI
|
|||
failed = true;
|
||||
}
|
||||
}
|
||||
|
||||
ThreadPool.QueueUserWorkItem(SendUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue