From 263e1761fc8705e4947a4a112be185fc6c180a1c Mon Sep 17 00:00:00 2001
From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
Date: Mon, 15 May 2023 14:47:12 +1200
Subject: [PATCH] Move jobQueue to engine (#16443)
---
Content.Server/CPUJob/JobQueues/IJob.cs | 8 -
Content.Server/CPUJob/JobQueues/Job.cs | 230 ------------------
.../CPUJob/JobQueues/Queues/JobQueue.cs | 76 ------
.../JobQueues/Queues/PathfindingJobQueue.cs | 4 +-
Content.Server/NPC/HTN/HTNPlanJob.cs | 2 +-
Content.Server/NPC/HTN/HTNSystem.cs | 4 +-
Content.Server/Procedural/DungeonJob.cs | 2 +-
Content.Server/Procedural/DungeonSystem.cs | 2 +-
.../Salvage/SalvageSystem.Expeditions.cs | 4 +-
.../Salvage/SpawnSalvageMissionJob.cs | 2 +-
Content.Tests/Server/Jobs/JobQueueTest.cs | 4 +-
11 files changed, 13 insertions(+), 325 deletions(-)
delete mode 100644 Content.Server/CPUJob/JobQueues/IJob.cs
delete mode 100644 Content.Server/CPUJob/JobQueues/Job.cs
delete mode 100644 Content.Server/CPUJob/JobQueues/Queues/JobQueue.cs
diff --git a/Content.Server/CPUJob/JobQueues/IJob.cs b/Content.Server/CPUJob/JobQueues/IJob.cs
deleted file mode 100644
index 283466f4ba..0000000000
--- a/Content.Server/CPUJob/JobQueues/IJob.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace Content.Server.CPUJob.JobQueues
-{
- public interface IJob
- {
- JobStatus Status { get; }
- void Run();
- }
-}
diff --git a/Content.Server/CPUJob/JobQueues/Job.cs b/Content.Server/CPUJob/JobQueues/Job.cs
deleted file mode 100644
index a0f8082bec..0000000000
--- a/Content.Server/CPUJob/JobQueues/Job.cs
+++ /dev/null
@@ -1,230 +0,0 @@
-using System.Threading;
-using System.Threading.Tasks;
-using Robust.Shared.Timing;
-using Robust.Shared.Utility;
-
-namespace Content.Server.CPUJob.JobQueues
-{
- ///
- /// CPU-intensive job that can be suspended and resumed on the main thread
- ///
- ///
- /// Implementations should overload .
- /// Inside , implementations should only await on ,
- /// , or .
- ///
- /// The type of result this job generates
- public abstract class Job : IJob
- {
- public JobStatus Status { get; private set; } = JobStatus.Pending;
-
- ///
- /// Represents the status of this job as a regular task.
- ///
- public Task AsTask { get; }
-
- public T? Result { get; private set; }
- public Exception? Exception { get; private set; }
- protected CancellationToken Cancellation { get; }
-
- public double DebugTime { get; private set; }
- private readonly double _maxTime;
- protected readonly IStopwatch StopWatch;
-
- // TCS for the Task property.
- private readonly TaskCompletionSource _taskTcs;
-
- // TCS to call to resume the suspended job.
- private TaskCompletionSource