Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static generic instruction processor #513

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Package/UnityHelpers/2018.3/Internal/PromiseBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ internal static void ResetStaticState()
return;
}

s_instance.ResetProcessors();
ResetProcessors();
s_instance.ResetConfig();
s_instance = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ internal sealed partial class PromiseBehaviour
internal static SingleInstructionProcessor s_endOfFrameProcessor = new SingleInstructionProcessor(4);

// Generic processor for instructions that need to be called every frame potentially multiple times.
internal InstructionProcessorGroup _updateProcessor = new InstructionProcessorGroup(16);
internal static InstructionProcessorGroup s_genericProcessor = new InstructionProcessorGroup(16);

private static void SetTimeValues()
{
Expand All @@ -86,14 +86,14 @@ private void Init()
StartCoroutine(EndOfFrameRoutine());
}

private void ResetProcessors()
private static void ResetProcessors()
{
s_waitOneFrameProcessor.Clear();
s_updateProcessor.Clear();
s_lateUpdateProcessor.Clear();
s_fixedUpdateProcessor.Clear();
s_endOfFrameProcessor.Clear();
_updateProcessor.ResetProcessors();
s_genericProcessor.ResetProcessors();
}

private IEnumerator UpdateRoutine()
Expand All @@ -103,7 +103,7 @@ private IEnumerator UpdateRoutine()
yield return null;
SetTimeValues();
s_waitOneFrameProcessor.Process();
_updateProcessor.Process();
s_genericProcessor.Process();
}
}

Expand Down
2 changes: 1 addition & 1 deletion Package/UnityHelpers/2018.3/PromiseYieldExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public void OnCompleted(Action continuation)
InternalHelper.ValidateIsOnMainThread(1);
var copy = this;
copy._continuation = continuation;
InternalHelper.PromiseBehaviour.Instance._updateProcessor.WaitFor(copy);
InternalHelper.PromiseBehaviour.s_genericProcessor.WaitFor(copy);
}

/// <summary>
Expand Down
Loading