mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-28 05:43:37 -05:00
ファイル分割。Post
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
namespace System.Runtime.CompilerServices
|
||||
{
|
||||
public sealed class AsyncMethodBuilderAttribute : Attribute
|
||||
{
|
||||
public AsyncMethodBuilderAttribute(Type builderType)
|
||||
{
|
||||
BuilderType = builderType;
|
||||
}
|
||||
|
||||
public Type BuilderType { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 010eb0dc48af5e645af2ff8cb7f7d1d8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -4,18 +4,6 @@ using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System.Runtime.CompilerServices
|
||||
{
|
||||
public sealed class AsyncMethodBuilderAttribute : Attribute
|
||||
{
|
||||
public AsyncMethodBuilderAttribute(Type builderType)
|
||||
{
|
||||
BuilderType = builderType;
|
||||
}
|
||||
|
||||
public Type BuilderType { get; }
|
||||
}
|
||||
}
|
||||
|
||||
namespace UniGLTF.AltTask
|
||||
{
|
||||
@@ -30,54 +18,6 @@ namespace UniGLTF.AltTask
|
||||
IAwaiter<T> GetAwaiter();
|
||||
}
|
||||
|
||||
public class TaskQueue : SynchronizationContext, IDisposable
|
||||
{
|
||||
[ThreadStatic]
|
||||
static TaskQueue s_queue;
|
||||
|
||||
public new static SynchronizationContext Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (s_queue == null)
|
||||
{
|
||||
return System.Threading.SynchronizationContext.Current;
|
||||
}
|
||||
else
|
||||
{
|
||||
return s_queue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Queue<Action> m_tasks = new Queue<Action>();
|
||||
|
||||
public static TaskQueue Create()
|
||||
{
|
||||
return new TaskQueue();
|
||||
}
|
||||
|
||||
TaskQueue()
|
||||
{
|
||||
s_queue = this;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
s_queue = null;
|
||||
}
|
||||
|
||||
public bool ExecuteOneCallback()
|
||||
{
|
||||
if (m_tasks.Count == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var task = m_tasks.Dequeue();
|
||||
task();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public struct ExplicitTaskMethodBuilder<T>
|
||||
{
|
||||
|
||||
60
Assets/UniGLTF/Runtime/UniGLTF/IO/AltTask/TaskQueue.cs
Normal file
60
Assets/UniGLTF/Runtime/UniGLTF/IO/AltTask/TaskQueue.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace UniGLTF.AltTask
|
||||
{
|
||||
public class TaskQueue : SynchronizationContext, IDisposable
|
||||
{
|
||||
[ThreadStatic]
|
||||
static TaskQueue s_queue;
|
||||
|
||||
public new static SynchronizationContext Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (s_queue == null)
|
||||
{
|
||||
return System.Threading.SynchronizationContext.Current;
|
||||
}
|
||||
else
|
||||
{
|
||||
return s_queue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Post(SendOrPostCallback d, object state)
|
||||
{
|
||||
m_tasks.Enqueue(() => d(state));
|
||||
}
|
||||
|
||||
Queue<Action> m_tasks = new Queue<Action>();
|
||||
|
||||
public static TaskQueue Create()
|
||||
{
|
||||
return new TaskQueue();
|
||||
}
|
||||
|
||||
TaskQueue()
|
||||
{
|
||||
s_queue = this;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
s_queue = null;
|
||||
}
|
||||
|
||||
public bool ExecuteOneCallback()
|
||||
{
|
||||
if (m_tasks.Count == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var task = m_tasks.Dequeue();
|
||||
task();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/UniGLTF/Runtime/UniGLTF/IO/AltTask/TaskQueue.cs.meta
Normal file
11
Assets/UniGLTF/Runtime/UniGLTF/IO/AltTask/TaskQueue.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6a65e00e71613c24e865e35173c30be0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user