Robust and efficient library for management of asynchronous operations in C#/.Net.
Fixes:
Promise.ParallelFor*
canceling workers too early.Promise.ParallelFor*
and AsyncEnumerable.Merge
propagate exceptions from cancelation token callbacks instead of deadlocking.Misc:
AsyncEnumerable.Merge
more eagerly stops iteration if a rejection or cancelation occurs.Fixes:
Promise<T>.IsValid
when it was completed synchronously.Enhancements:
UnityEngine.Awaitable
extensions to convert to Promise
.ReadOnlySpan<T>
parameter.
CancelationSource.New
AsyncEnumerable<T>.Merge
Promise(<T>).{All(Settled), Race(WithIndex), First(WithIndex)}
CancelationToken.TryRegisterWithoutImmediateInvoke<TCancelable>
API.AsyncSemaphore.EnterScopeAsync(CancelationToken)
and AsyncSemaphore.EnterScope(CancelationToken)
overloads.Fixes:
Promise.ParallelForEach
.Optimizations:
Breaking Changes:
Deferred.{(Try)ReportProgress, (Try)Cancel, State, Retain, Release, New(CancelationToken)}
Promise.{Progress, AwaitWithProgress, NewDeferred(CancelationToken), Wait(TimeSpan), Retain, Release, New<T>, New<TCapture, T>, Rejected<T, TReject>, Canceled<TCancel>, Canceled<T, TCancel>, CancelException<T>}
Promise<T>.{WaitForResult(TimeSpan, out T), Retain, Release, AllNonAlloc, Canceled<TCancel>, NewDeferred(CancelationToken)}
CanelationRegistration.Unregister
CancelationSource.(Try)Cancel<TReason>
CancelationToken.{Retain, CancelationValueType, CancelationValue, TryGetCancelationValueAs<T>}
PoolType
Promise.Config.{ObjectPooling, WarningHandler}
Promise.Manager.{HandleCompletes, HandleCompletesAndProgress, HandleProgress, LogWarning}
ReasonContainer
Promise.ResultContainer.{RejectReason, RejectContainer, CancelContainer}
Promise<T>.ResultContainer.{Result, RejectReason, RejectContainer, CancelContainer}
AsyncMonitor.{WaitAsync(AsyncLock.Key, CancelationToken), Wait(AsyncLock.Key, CancelationToken)}
PromiseYielder.WaitOneFrame(MonoBehaviour)
UnhandledException.{ValueType, TryGetValueAs<T>}
CanceledException.{ValueType, Value, TryGetValueAs<T>}
Promise(<T>).{ContinueFunc, ContinueAction}
delegates.Promise(<T>).ContinueWith
parameter delegate types changed to standard System.Action
and System.Func<>
.IRetainable
interface.AsyncReaderWriterLock
upgrade key type changed from AsyncReaderWriterLock.WriterKey
to AsyncReaderWriterLock.UpgradedWriterKey
.Proto.Promises.Async.CompilerServices
namespace changed to Proto.Promises.CompilerServices
.PromiseMethodBuilder(<T>)
types renamed to AsyncPromiseMethodBuilder(<T>)
.Proto.Promises.Extensions
to Proto.Promises.TaskExtensions
and Proto.Promises.CancellationTokenExtensions
Enhancements:
AsyncEnumerable<T>
allocation-free async iterators (requires C# 7.3 or newer).AsyncEnumerable<T>
.ContentionStrategy
to AsyncReaderWriterLock
.Promise.ParallelForEachAsync
APIs to consume AsyncEnumerable<T>
and IAsyncEnumerable<T>
in parallel.Progress
APIs.Promise.Finally
overloads accepting Func<Promise>
delegates to support DisposeAsync
.PromiseYielder.{WaitForUpdate, WaitForLateUpdate}
APIs.Fixes:
AsyncLocal<T>
in Promise.Parallel*
body.Optimizations:
async Promise
functions in netstandard2.1 and Unity 2021.2 or newer.Deprecated:
Deferred.ReportProgress
, Promise.Progress
, Promise.AwaitWithProgress
). Replaced with new Progress
APIs.Fixes:
PromiseYielder.WaitOneFrame().ToPromise()
waits an extra frame in Unity versions older than 2021.2.Optimizations:
Enhancements:
Promise.AllSettled
and Promise.MergeSettled
APIs.ExceptionDispatchInfo
).Fixes:
NullReferenceException
when PromiseYielder
is used after OnApplicationQuit
.Optimizations:
Interlocked
instead of lock for faster Promise.ParallelFor
.PromiseSynchronizationContext.Post
.Deprecated:
ResultContainer.Result
, renamed to ResultContainer.Value
.ResultContainer.RejectReason
, renamed to ResultContainer.Reason
.Fixes:
IndexOutOfRangeException
when a PromiseYielder
function is used more than 64 times simultaneously.Fixes:
Promise.ParallelForEach
and Promise.ParallelFor
.Optimizations:
CancelationSource
.CancelationToken
s.Fixes:
Promise.ParallelForEach
and Promise.ParallelFor
.Promise.ParallelForEach
and Promise.ParallelFor
.Promise.Canceled()
caused the parent promise to be mutated after it was repooled.Optimizations:
Promise.ParallelForEach
and Promise.ParallelFor
.Promise.Run
.Promise.New
.Fixes:
CancelationToken
s when object pooling is enabled.Deferred.ReportProgress
is called concurrently with Deferred.Resolve/Reject/Cancel
.