synchronized 3.6.1+1
synchronized: ^3.6.1+1 copied to clipboard
Lock mechanism to prevent concurrent access to asynchronous code.
Changelog #
3.6.1+1 #
- Documentation: getting started, which lock to use (
GlobalLockplatforms), common mistakes,example/main.dart,GlobalLockdartdoc, synchronized-lock skill update synchronizedwith atimeoutthat had to wait now releases the lock as soon as it completes; theObject.synchronizedextension no longer keeps the monitor in its global lock cache after such a callGlobalLock(io): a waiter takes a lock file over once it has itself seen the file untouched for 10 seconds (timed on its own monotonic stopwatch): a wall clock jump or a resumed machine no longer breaks a live lock, and a file time in the future no longer delays the takeover of a dead one. A lock left by a dead process is now taken over 10 seconds after a waiter first sees it, not at onceGlobalLock(web): names starting with-(reserved by the Web Locks API) now work, requested assynchronized_global_lock:<name>(every other name keeps its lock name), and a rejected request throws its own error instead of aTimeoutException
3.6.1 #
GlobalLock(io): the heartbeat runs in its own isolate, so the lock stays held while the event loop of the holder is blocked (synchronous work,Process.runSync), is released at once when the holder isolate exits or is killed without releasing it (instead of 10 seconds later), and no longer keeps the holder isolate alive- Document that on node the lock only covers the current process (its Web Locks API)
3.6.0 #
- Add
GlobalLock(package:synchronized/global_lock.dart), a named lock shared by the isolates and processes of the machine (a lock file with a heartbeat, taken over 10 seconds after its holder died) or by the tabs and workers of the origin on the web (Web Locks API), withsynchronizedandacquire/release
3.5.0 #
- Fix
ReentrantLock.canLockreporting the lock free right after a synchronous block while other calls were still queued, which letsynchronizedSyncrun before earliersynchronizedcalls. In that casecanLockis nowfalseandsynchronizedSyncreturns aFuturethat completes in order. - Example:
readme2was never called and now usescanLock
3.4.2 #
- Add
synchronized-lockagent skill (skills/), installable withdart run skills@ get
3.4.1+2 #
- Requires dart 3.12
- Improve documentation
MultiLocktimeoutnow bounds the whole acquisition (one shared budget) instead of each underlying lockMultiLockcopies its locks at constructionsynchronizedSyncasserts (in debug mode) when the computation returns aFutureReentrantLock.canLockthrows aStateError(instead of aRangeError, ortrue) when called from a zone that outlived itssynchronizedblock- Add
MultiLock.toString
3.4.0+1 #
- Requires dart 3.11
3.4.0 #
- Requires dart 3.8
- Add
synchronizedSyncfor synchronous computation that returns aFutureOr
3.3.1 #
- Required dart 3.7
3.3.0+3 #
- Add MultiLock (thanks to @saibotma)
3.2.0 #
- Required dart 3.5
3.1.0+1 #
- Dart 3 support
3.0.1 #
- strict-casts and sdk 2.18 support
3.0.0+3 #
- Add MIT licence
3.0.0+2 #
null safetysupport, breaking change
2.2.0+2 #
- Add
SynchronizedLockextension to turn any object into a lock.
2.1.1 #
- pedantic 1.9 support
2.1.0+3 #
- Fix reentrant lock to properly synchronize inner blocks
2.0.0 #
- Remove previously deprecated
SynchronizedLockandsynchronizedfunction
1.5.2 #
- Remove dev_test dependency
1.5.1 #
- Dart2 stable support
1.5.0 #
- Deprecate SynchronizedLock and synchronized
1.4.0 #
- Re-use non-reentrant lock in synchronized method
1.3.0 #
- Add non-reentrant lock that do not use Zone
1.2.1 #
- implicit-casts: false (testing dart2 support)
1.2.0 #
- Use generic instead of 2.0 deprecated comments
1.1.0 #
- Fix inner task issue, next outer task will wait for all inner tasks to terminate
- Properly handle nested thrown error
1.0.0 #
- Bump to version 1.0.0
0.1.0 #
- Initial version