mirror of
https://github.com/copyrighttxt/watrbx-game-engine.git
synced 2026-09-05 21:27:48 +00:00
28 lines
728 B
C#
28 lines
728 B
C#
using System.Reflection;
|
|
using Microsoft.Ccr.Core;
|
|
|
|
namespace Roblox;
|
|
|
|
public class PatchedDispatcherQueue : DispatcherQueue
|
|
{
|
|
private static FieldInfo _Next = typeof(TaskCommon).GetField("_next", BindingFlags.Instance | BindingFlags.NonPublic);
|
|
|
|
private static FieldInfo _Previous = typeof(TaskCommon).GetField("_previous", BindingFlags.Instance | BindingFlags.NonPublic);
|
|
|
|
public PatchedDispatcherQueue(string name, Dispatcher dispatcher)
|
|
: base(name, dispatcher)
|
|
{
|
|
}
|
|
|
|
public override bool TryDequeue(out ITask task)
|
|
{
|
|
bool result = base.TryDequeue(out task);
|
|
if (result && task is TaskCommon taskCommon)
|
|
{
|
|
_Next.SetValue(taskCommon, null);
|
|
_Previous.SetValue(taskCommon, null);
|
|
}
|
|
return result;
|
|
}
|
|
}
|