mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-06-27 13:33:13 +00:00
New awaiters
This commit is contained in:
@ -6,20 +6,21 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Esyur.Core
|
||||
{
|
||||
public class AsyncAwaiter<T> : INotifyCompletion
|
||||
public class AsyncAwaiter : INotifyCompletion
|
||||
{
|
||||
Action callback = null;
|
||||
|
||||
AsyncException exception = null;
|
||||
|
||||
T result;
|
||||
object result;
|
||||
|
||||
|
||||
public AsyncAwaiter(AsyncReply reply)
|
||||
{
|
||||
reply.Then(x =>
|
||||
{
|
||||
this.IsCompleted = true;
|
||||
this.result = (T)x;
|
||||
this.result = x;
|
||||
this.callback?.Invoke();
|
||||
}).Error(x =>
|
||||
{
|
||||
@ -29,7 +30,7 @@ namespace Esyur.Core
|
||||
});
|
||||
}
|
||||
|
||||
public T GetResult()
|
||||
public object GetResult()
|
||||
{
|
||||
if (exception != null)
|
||||
throw exception;
|
||||
@ -47,6 +48,6 @@ namespace Esyur.Core
|
||||
callback = continuation;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user