complete except trigger

This commit is contained in:
neuecc
2020-05-04 01:59:22 +09:00
parent f28743f7f6
commit 7bc9ef90f1
19 changed files with 960 additions and 1024 deletions

View File

@@ -1,130 +0,0 @@
#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6))
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
using System;
using System.Threading;
namespace UniRx.Async.Internal
{
internal sealed class LazyPromise : IAwaiter
{
Func<UniTask> factory;
UniTask value;
public LazyPromise(Func<UniTask> factory)
{
this.factory = factory;
}
void Create()
{
var f = Interlocked.Exchange(ref factory, null);
if (f != null)
{
value = f();
}
}
public bool IsCompleted
{
get
{
Create();
return value.IsCompleted;
}
}
public UniTaskStatus Status
{
get
{
Create();
return value.Status;
}
}
public void GetResult()
{
Create();
value.GetResult();
}
void IAwaiter.GetResult()
{
GetResult();
}
public void UnsafeOnCompleted(Action continuation)
{
Create();
value.GetAwaiter().UnsafeOnCompleted(continuation);
}
public void OnCompleted(Action continuation)
{
UnsafeOnCompleted(continuation);
}
}
internal sealed class LazyPromise<T> : IAwaiter<T>
{
Func<UniTask<T>> factory;
UniTask<T> value;
public LazyPromise(Func<UniTask<T>> factory)
{
this.factory = factory;
}
void Create()
{
var f = Interlocked.Exchange(ref factory, null);
if (f != null)
{
value = f();
}
}
public bool IsCompleted
{
get
{
Create();
return value.IsCompleted;
}
}
public UniTaskStatus Status
{
get
{
Create();
return value.Status;
}
}
public T GetResult()
{
Create();
return value.Result;
}
void IAwaiter.GetResult()
{
GetResult();
}
public void UnsafeOnCompleted(Action continuation)
{
Create();
value.GetAwaiter().UnsafeOnCompleted(continuation);
}
public void OnCompleted(Action continuation)
{
UnsafeOnCompleted(continuation);
}
}
}
#endif

View File

@@ -8,7 +8,8 @@ using System.Runtime.CompilerServices;
namespace UniRx.Async.Internal
{
// optimized version of Standard Queue<T>.
internal class MinimumQueue<T>
// TODO: to internal.
public class MinimumQueue<T>
{
const int MinimumGrow = 4;
const int GrowFactor = 200;
@@ -28,7 +29,7 @@ namespace UniRx.Async.Internal
public int Count
{
#if NET_4_6 || NET_STANDARD_2_0
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
get { return size; }
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: fe7a4187b7f89f84582fd1e466a7f27e
guid: 60cdf0bcaea36b444a7ae7263ae7598f
MonoImporter:
externalObjects: {}
serializedVersion: 2