mirror of
https://github.com/godotengine/godot.git
synced 2024-12-15 10:12:40 +08:00
995a40e8ef
Added dummy MSBuild project and solution to get tooling help when editing these files.
26 lines
786 B
C#
26 lines
786 B
C#
using System.Collections.Concurrent;
|
|
using System.Collections.Generic;
|
|
using System.Threading;
|
|
|
|
namespace Godot
|
|
{
|
|
public class GodotSynchronizationContext : SynchronizationContext
|
|
{
|
|
private readonly BlockingCollection<KeyValuePair<SendOrPostCallback, object>> queue = new BlockingCollection<KeyValuePair<SendOrPostCallback, object>>();
|
|
|
|
public override void Post(SendOrPostCallback d, object state)
|
|
{
|
|
queue.Add(new KeyValuePair<SendOrPostCallback, object>(d, state));
|
|
}
|
|
|
|
public void ExecutePendingContinuations()
|
|
{
|
|
KeyValuePair<SendOrPostCallback, object> workItem;
|
|
while (queue.TryTake(out workItem))
|
|
{
|
|
workItem.Key(workItem.Value);
|
|
}
|
|
}
|
|
}
|
|
}
|