Enhancements:
- Added
Proto.Timers
.Timer
andTimerFactory
- Added
Promise.Delay
APIs. - Added
Promise(<T>).WaitAsync
APIs with timeouts. - Added delayed cancelation APIs to
CancelationSource
.CancelationSource.New(TimeSpan, (optional) TimerFactory, (optional) linked token(s))
CancelationSource.CancelAfter(TimeSpan)
- Added
CancelationToken(bool)
constructor. - Added
CancelationToken.RegisterWithoutImmediateInvoke
APIs. - Added
PromiseYielder.Initialize()
API to help with early code running before Unity can auto initialize.
Fixes:
- Fixed Unity initialization not being fully initialized before user
Awake
methods run.
Optimizations:
Promise(<T>).ConfigureAwait(ContinuationOptions)
consumes zero memory ifPromise.Config.AsyncFlowExecutionContextEnabled
is disabled (which is the default state).- Reduced memory of
async Promise(<T>)
. - Reduced memory of async synchronization primitives
- Reduced memory of
Promise.ParallelFor*
APIs. - Reduced memory of
Channel
s. - Optimized object pool contention.
- Internally avoid cost of zeroing types that contain no references.
- Split
Promise(<T>).ContinueWith
methods without aCancelationToken
parameter to avoid the cost of the token when it's not needed. - Reduced memory and increased speed of
AsyncLazy<T>
when the factory is invoked. - No longer pool memory allocated from
AsyncLazy<T>
.
Deprecated:
Promise(<T>).{Then, Catch, CatchCancelation}
APIs accepting aCancelationToken
parameter. (PreferWaitAsync
followed by the same API without the token.)- Deprecated
CancelationSource.{IsValid, TryCancel, TryDispose}
. (Prefer!= default
and methods withoutTry
prefix.) - Deprecated
CancelationToken.{TryRegister, TryRegisterWithoutImmediateInvoke}
. (PreferCanBeCanceled
and methods withoutTry
prefix.) - Deprecated
Promise(<T>).Deferred.{IsValid*, Try*}
APIs. (Prefer!= default
.) - Deprecated
Promise(<T>).IsValid
.
Misc:
- Changed behavior of
CancelationSource.Cancel
to not throw if it's called more than once. - Changed behavior of
CancelationSource
,Promise(<T>).Deferred
,Channel(Reader/Writer)
to throwNullReferenceException
if it's default.