diff --git a/Robust.Shared/Threading/ParallelManager.cs b/Robust.Shared/Threading/ParallelManager.cs
index dfd33877c4a..4f6a5c63dab 100644
--- a/Robust.Shared/Threading/ParallelManager.cs
+++ b/Robust.Shared/Threading/ParallelManager.cs
@@ -23,7 +23,7 @@ public interface IParallelManager
/// Takes in a job that gets flushed.
///
///
- JobHandle Process(IRobustJob job);
+ ValueTask Process(IRobustJob job);
///
/// Takes in a parallel job and runs it the specified amount.
@@ -38,7 +38,7 @@ public interface IParallelManager
///
/// Takes in a parallel job and runs it without blocking.
///
- JobHandle Process(IParallelRobustJob jobs, int amount);
+ ValueTask Process(IParallelRobustJob jobs, int amount);
///
/// Waits for the specified job handles to finish.
@@ -64,6 +64,10 @@ public void Initialize()
{
_cfg.OnValueChanged(CVars.ThreadParallelCount, UpdateCVar, true);
+ // TODO: Finish porting the other big parallel methods.
+ // TODO: Try using ValueTask returns and see if it's okay.
+ // If it is then try swapping JobScheduler back out for Threadpool
+
_scheduler = new JobScheduler(new JobScheduler.Config()
{
ThreadCount = ParallelProcessCount,
@@ -89,7 +93,7 @@ private void UpdateCVar(int value)
}
}
- public JobHandle Process(IRobustJob job)
+ public ValueTask Process(IRobustJob job)
{
var handle = _scheduler.Schedule(job);
_scheduler.Flush();
@@ -99,7 +103,7 @@ public JobHandle Process(IRobustJob job)
public void ProcessNow(IParallelRobustJob job, int amount)
{
var handle = Process(job, amount);
- handle.Complete();
+ handle.AsTask().Wait();
}
public void ProcessSerialNow(IParallelRobustJob jobs, int amount)
@@ -110,7 +114,7 @@ public void ProcessSerialNow(IParallelRobustJob jobs, int amount)
}
}
- public JobHandle Process(IParallelRobustJob job, int amount)
+ public ValueTask Process(IParallelRobustJob job, int amount)
{
var handle = _scheduler.Schedule(job, amount);
_scheduler.Flush();