Releases: timcassell/ProtoPromise
Releases · timcassell/ProtoPromise
v2.0.2
Fixes:
- Fixed
Promise.AwaitWithProgress
not working in IL2CPP. - Fixed a rare race condition where a canceled promise could cause an invalid cast exception.
Optimizations:
- Fixed boxing nullable value-types.
- Reduced size of cancelable promises.
- Subscribing to progress now runs in O(1) time and consumes O(1) memory, down from O(n) for both.
Misc:
- Increased precision of progress, from 1/(2^13) to 1/(2^16).
v2.0.1
Fixes:
- Fixed a memory leak with All/Merge/Race/First promises when object pooling is enabled.
- Fixed state check in
PromiseYieldInstruction
when the promise is already complete.
Optimizations:
- Less pooled memory when
T
ofPromise<T>
is a reference type and used by more than 1 types (example:Promise<string>
andPromise<object>
). - More efficient execution in the common case.
v2.0.0
Enhancements:
- Full library thread-safety with minimal locks.
- Added
Deferred.Cancel
. - Added
Deferred
andCancelationSource
andCancelationToken
andCancelationRegistration
Try...
methods. - Added
CancelationRegistration
methods to unregister/check registration and if the token is requesting cancelation atomically. - Added static
CancelationToken.Canceled()
to get a token already in the canceled state without allocating. - Added
Promise(<T>).WaitAsync(SynchronizationOption)
andPromise(<T>).WaitAsync(SynchronizationContext)
to schedule the next callback/await on the desired context. - Added
Promise.Run
static functions. - Added
Promise.SwitchToForeground()
,Promise.SwitchToBackground()
, andPromise.SwitchToContext(SynchronizationContext)
static functions. - Added
Promise.AwaitWithProgress(float minProgress, float maxProgress)
API to propagate the progress to anasync Promise(<T>)
function.
Optimizations:
- Promises are now structs, making already resolved promises live only on the stack, increasing performance.
- Eliminated potential
StackOverflowException
s fromasync
/await
continuations when both theasync
function and theawait
ed object arePromise(<T>)
. - Optimized
async Promise(<T>)
functions in Unity 2021.2 or newer when IL2CPP is used.
Breaking Changes:
- Promises are now structs instead of classes.
- Changed behavior of
Promise.CatchCancelation
to return a new promise and behave more likePromise.Catch
, whereonCanceled
resolves the returned promise when it returns, or adopts the state of the returned promise. - Removed cancelation reasons.
- A rejected promise awaited in an async function now throws the original exception, if the promise was rejected with an exception.
- Deprecations and other breaking changes (see full release notes).
See Release Notes for the full changelog.
v1.0.3
Fixed a compile error when building with IL2CPP runtime.
v1.0.2
Fixed uncaught rejections not being reported from reused promise objects.
v1.0.1
- Fix sln and csproj configurations.
- Fix formatting in README.md.
v1.0.0
Bug Fixes
- Fixed PromiseMethodBuilders in non-IL2CPP builds when the TStateMachine is a struct.
- Fixed various progress bugs.
- Fixed CancelationToken.Equals(object).
Behavior changes
- Added thread checks to make sure the library is only used with one thread (in DEBUG mode only).
Misc
- Removed class restriction on PromiseYielder.WaitFor (since there are some structs that can be yielded in Coroutines, like
AsyncOperationHandle
s).
Allocation-Free Async Promise Functions
Optimizations
- Added object pooling for allocation-free async Promise functions.
- Removed LitePromises, using DeferredPromises for Promise.Resolved/Rejected/Canceled instead to reduce amount of code.
Bug Fixes
- Fixed causality traces in async Promise functions.
- Fixed aggregate exception not capturing the unhandled exceptions.
Misc
- Added message to unhandled exceptions, when not in DEBUG mode, to explain how to see causality traces.
Async Promise Functions Fix
- Fixed PromiseMethodBuilders for async Promise functions with the IL2CPP compiler.
- Ignore Internal functions and PromiseYielder.Routines in causality traces.
- Include causality trace from invalid returned promise.
Implicit DeferredBase Cast
Added implicit cast operators that I forgot for Promise.Deferred
-> Promise.DeferredBase
and Promise<T>.Deferred
-> Promise.DeferredBase
.