multitasking 5.2.0
multitasking: ^5.2.0 copied to clipboard
Cooperative multitasking using asynchronous tasks and synchronization primitives, with the ability to safely cancel groups of nested tasks performing I/O wait or listen operations.
Changelog #
5.2.0 #
- Breaking change: Removed
withCancellationHandler()andlistenWithCancellationHandler()methods fromStreamExtensionextension. - Added
withSubscriptionTracking()method toStreamExtensionextensions. As a replacement for the removedwithCancellationHandler()andlistenWithCancellationHandler()methods.
5.1.0 #
- Breaking change: Removed class
ZoneStats. This functionality only slows down the execution of tasks. - Added method
withCancellationHandler()toStreamExtensionextension. - Added method
listenWithCancellationHandler()toStreamExtensionextension.
5.0.0 #
- Breaking change: Removed deprecated class
Throughput. - Breaking change: Removed deprecated class
TokenBucket. - Breaking change: Code normalization, the
statefield of theTaskclass has been renamed tostatus. - Breaking change: Code normalization, the
TaskStateenum has been renamed toTaskStatus. - Breaking change: Code normalization, the
completedvalue of theTaskStatusenum has been renamed tosuccessful. - Breaking change: The
isCompletedgetter of theTaskclass has been renamed toisSuccessful. - Breaking change: The
isStartedgetter of theTaskclass has been removed. - Documentation has been added or changed.
4.6.0 #
- Breaking change: The
runCancelable()method of theCancellationTokenclass no longer throws aTaskCanceledExceptionexception, in case the cancellation request occurred after the successful completion of the operation. Now the main purpose is to add and automatically remove a cancel handler in the token to cancel the operation. After successful completion of the operation, it is recommended to usetoken.throwIfCanceled()if necessary. - Changed example
example_task_cancel_long_network.dart. - Changed example
example_task_cancel_network.dart. - Changed example
example_task_download_file.dart. - Changed example
example.dart.
4.5.0 #
- Fixed a bug in
StreamExtension.listenWithCancellation(): ThethrowIfCancelledparameter has been renamed tothrowIfCanceled. - Added method
asCancelable()toStreamExtensionextension.
4.4.0 #
- Deprecated class
TokenBucket. - Added method
withCancellation()toTaskclass. - Added example
example_task_cancel_waiting_for_non_cancelable_action.dart. - Added extension
StreamExtensionwithlistenWithCancellation()method. - Added method
createLinkedTokenSource()toCancellationTokenSourceclass.
4.3.0 #
- Several typos have been corrected.
- Added example
example_task_await_in_order_of_receipt.dart. - Added class
TokenBucket. - Added class
SpeedTest. - Deprecated class
Throughput. - Added example
example_token_bucker.dart.
4.2.0 #
- Added method
cancelAfter()toCancellationTokenSourceclass. - The operating algorithm of the
TaskCompletionSourcehas been improved.
4.1.0 #
- Changed example
example_task_wait_in_different_ways.dart. - Added example
example_task_stream.dart. - Added method
whenEach()toTaskclass. - Added method
delay()toTaskclass. - Breaking change: Code normalization, the
cancelledidentifiers have been renamed tocanceled. - Breaking change: Code normalization, the
cancellableidentifiers have been renamed tocancelable.
4.0.0 #
- Breaking change: Code cleanup, removed the following functions:
runAndDetach(),runCancellable(). - Breaking change: Code cleanup, removed the classes:
CancellableStreamIterator. - Breaking change: Code normalization, renamed
TaskCanceledErrorclass toTaskCanceledException. Also, this class now implements theExceptioninterface and no longer extends theErrorclass. - Non-breaking change: The following methods now return
Future<void>instead ofvoid:Task.start(),PauseToken.pause(),PauseToken.resume().
3.8.0 #
- Added method
whenAny()toTaskclass. - Added method
whenAll()toTaskclass. - Changed signature of
waitAll()method ofTaskclass toFuture<void> waitAll<T>(List<Task<T>> tasks, {Progress<({int count, int total})>? progress}). Now, when specifying aprogressparameter it is possible to track the progress of the wait operation. - Added class
CountdownTimer
3.7.0 #
- Changed signature of
wait()method ofPauseTokenclass toFuture<void> wait({CancellationToken? token}). Now, when specifying atokenparameter, the method can throw aTaskCanceledErrorexception.
3.6.0 #
- Added method
reacquire()toLockclass. This method is implemented exclusively to ensure fair operation of reacquiring the lock in condition variable in thewait()method. - Fixed a bug in
ManualResetEvent.
3.5.0 #
- Added method
runCancellable()toCancellationTokenclass. TherunCancellable()function now forwards execution to this method. - Added
PauseTokenclass - Added
Throughputclass
3.4.0 #
- Changed example
example_task_cancel_long_network.dart. - Changed example
example_task_cancel_network.dart. - Changed example
example_task_cancel_during_stream_iteration.dart. - Added class
Progress - Changed example
example_task_download_file.dart.
3.3.0 #
- Non-breaking changes: Handlers of the
CancellationTokenclass can be asynchronous and now they are executed in thezonewhere the handlers were created via thescheduleMicrotask()call. - Fixed a bug in
AutoResetEventandManualResetEvent.
3.2.0 #
- Added example
example_task_wait_in_different_ways.dart. - Added class
ZoneStats - Added example
example_task_zone_stats.dart.
3.1.0 #
- Breaking change: Removed method
runGuardedfrom classCancellationToken. - Added function
runCancellable()tolib/src/task/cancellation.dart. - Added function
runAndDetach()tolib/src/task/cancellation.dart.
3.0.0 #
- Breaking change: The task immediately propagates an exception if it is an unhandled exception in the task zone. An unhandled exception in the task zone is considered to be an exception that occurs in the task zone after a task has completed.
- Added method
runGuarded()to classCancellationToken. Purpose: Perform asynchronous actions (especially when using I/O operations) with guaranteed protection from unhandled exceptions and "automatic" processing of task cancellation requests. - Added getter
resultto classTask. - Added example
example_task_handle_unhandled_error.dart. - Added example
example_task_result.dart.
2.11.0 #
The ConditionVariable.wait() implementation has been adjusted to make the implementation more consistent with the Moore monitor.
2.10.0 #
- Breaking change: The
ForEachclass has been removed in favor of a more correct way to achieve the same result - by using theSteamIteratorclass. - Added class
AutoResetEvent. - Added class
ManualResetEvent. - Added example
example_task_cancel_isolate.dart. - Added class
CancellableStreamIterator.
2.9.0 #
- Added class
MultipleWriteSingleReadObject. - Added example
example_multiple_write_single_read_object.dart. - Fixed typo in
README.md
2.8.0 #
- Changed the link to the image
mutex.gif. - Removed unused code from the
Lockclass. - The algorithm for the
ConditionVariable.tryWait()method has been corrected.
2.7.0 #
- Fixed a bug with incorrect use of
WaitQueue. - Fixed a bug in
ConditionVariable. - Added image
assets/images/mutex.gif.
2.6.0 #
- Slightly improved
ReentrantLockperformance. - The internal algorithm for processing the
Taskresult has been slightly changed. - Added getters for the
Task, for each task state (eg.isCompletedfor theTaskState.completedstate). - Breaking change: The
Synchronizerclass has been renamed toLock.
2.5.0 #
- Slightly improved
BinarySemaphoreperformance. - Slightly improved
ReentrantLockperformance. - Changed example
example_task_cancel_long_network.dart. - Changed example
example_task_cancel_network.dart. - Changed example
example_task_cancel_await_for_stream_emulation.dart. - Breaking change: Removed
Task.awaitFormethod. - Added class
ForEach.
2.4.0 #
- Breaking change: Removed type parameter from
ReentrantLockclass.
2.3.0 #
- Added table of contents in file
README.md. - Added class
ReentrantLock. - Added example
example_reentrant_lock.dart.
2.2.0 #
- Added an explanation of the operating principle and internal structure of the task.
- Changed package description.
- A unified mechanism for implementing a waiting queue has been added (
WaitQueue). - Breaking change:The signatures of some synchronization primitives have been changed to consistently use wait queues. This applies to methods that implement waiting with a timeout (
tryWait()).
2.1.0 #
- Added example
example_counting_semaphore.dart. - Added example
example_task_cancel_await_for_stream.dart. - Added method
static Task<void> awaitFor<R>(Stream<R> stream, CancellationToken token, bool Function(R) f). - Added class
CountingSemaphore. - Added class:
BinarySemaphore. - Breaking change: The functionality of the
CancellationTokenhandler has been changed. Performance and usability have been improved, and most importantly, the restriction on linking to a single task has been lifted. - Added example
example_task_cancel_during_sleep.dart. - Added example
example_binary_semaphore.dart. - Added class
Synchronizer. - Added class
ConditionVariable. - Added example
example_condition_variable.dart.
2.0.0 #
- Breaking change: Removed support for unsafe task termination.
- Added support for safe task cancellation.
1.2.0 #
- Minor corrections have been made to the examples.
1.1.0 #
- Fixed a bug that did not take into account that in Dart, a function cannot return a
Future<Future<T>>result. Dart automaticallyflattensthis value toFuture<T>. - Changed signature of the following methods in the
Taskclass:Future<Task<T>> run(),Future<void> start()toTask<T> run(),void start(). First method (run) was changed because Dart blocksFuture<Task<T>> Task<T>.run)until the task completes, the second method (start) was changed to be consistent with the first.
1.0.0 #
- Initial release.