Mainly more hauling optimizations, utilizing linked storage groups
This also adds an experimental, usually slower, threaded gas grid mode and implements a workaround for the whole mod and game failing to start when opening prepatcher's mod manager with unfortunate timing
This commit is contained in:
@@ -100,6 +100,15 @@ public static class ParallelNoAlloc
|
||||
return monitorObject;
|
||||
}
|
||||
|
||||
public static bool HasAnyRegisteredWorkers(object? monitorObject)
|
||||
{
|
||||
Guard.IsNotNull(monitorObject);
|
||||
|
||||
return monitorObject is MonitorObject.Group typedMonitorObject
|
||||
? typedMonitorObject.Subscribers.Length > 0
|
||||
: ThrowHelper.ThrowArgumentException<bool>();
|
||||
}
|
||||
|
||||
public static void DeregisterBackgroundWaitingWorker(object monitorObject, Action action)
|
||||
{
|
||||
Guard.IsNotNull(action);
|
||||
@@ -140,6 +149,8 @@ public static class ParallelNoAlloc
|
||||
typedMonitorObject.Pulse();
|
||||
}
|
||||
|
||||
internal static void ClearAll() => _groupWorkers.Clear();
|
||||
|
||||
private abstract class Worker : IFishPoolable
|
||||
{
|
||||
public Thread Thread { get; private set; }
|
||||
@@ -217,13 +228,10 @@ public static class ParallelNoAlloc
|
||||
|
||||
public void Invoke(Action action)
|
||||
{
|
||||
Guard.IsNotAssignableToType<MonitorObject.Group>(MonitorObject);
|
||||
|
||||
if (Pulsed)
|
||||
Spin();
|
||||
|
||||
|
||||
Action = action;
|
||||
|
||||
MonitorObject.Pulse();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user