This commit is contained in:
2022-06-25 11:08:50 +04:00
parent 679608bc48
commit 1e41b9f2eb
31 changed files with 152 additions and 645 deletions
+22
View File
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
namespace Ragon.Core;
public class Dispatcher: IDispatcher, IDispatcherInternal
{
public Queue<Action> _actions = new Queue<Action>();
public void Dispatch(Action action)
{
lock (_actions)
_actions.Enqueue(action);
}
public void Process()
{
lock(_actions)
while(_actions.TryDequeue(out var action))
action?.Invoke();
}
}