Releases: x42005e1f/aiologic
Releases · x42005e1f/aiologic
0.13.1
Fixed
- Optimized the event removal in locks and semaphores. Previously, removing an event from the waiting queue was performed even when it was successfully set, which caused serious slowdown due to expensive O(n) operations. Now the removal is only performed in case of failure - on cancellation, in particular timeouts, and exceptions. (#5).
0.13.0
Added
- Type annotations via stubs. They are tested via
mypy
andpyright
, but may cause ambiguities in some IDEs that do not support overloading well.
Changed
- The source code tree has been significantly changed for better IDEs support. The same applies to exports, which are now checker-friendly. Objects pickled in previous versions refer to the old tree, so aliases to old modules have been temporarily added. If you have these, it is strongly recommended to repickle them with this version to support future versions.
0.12.0
Changed
- Support for cancellation and timeouts has been dramatically improved. The
cancel()
method (and accompanyingis_cancelled()
) has been added to low-level events, which always returnsTrue
after the first successful call beforeset()
andFalse
otherwise. Previously, cancellation handling used the sameset()
call, which resulted in false negatives, in particular unnecessary wakes.
Fixed
- Added missing
await
keyword inaiologic.Condition
, without which it did not restore the state of the wrappedaiologic.RLock
(0.11.0
regression). - Priority queue initialization now ensures the heap invariant for the passed list. Previously, passing a list with an incorrect order of elements violated the order in which the priority queue elements were returned.
- Low-level event classes are now created in exclusive mode, eliminating possible slowdown in method resolution.
0.11.0
Added
aiologic.lowlevel.async_checkpoint()
as an alias foraiologic.lowlevel.checkpoint()
.
Changed
- The capabilities of
aiologic.Condition
have been extended. Since there is no clear definition of which locks it should wrap, support for sync-only locks such asthreading.Lock
has been added. Passing another instance ofaiologic.Condition
is now supported too, and implies copying a reference to its lock. Also, passingNone
now specifies a different behavior wherebyaiologic.Condition
acts as lockless: its methods ignore the lock, which should help to useaiologic.Condition
as a simple replacement for removedaiologic.ParkingLot
.
0.10.0
Changed
aiologic.lowlevel.shield()
function, which protects the call from cancellation, has been replaced byaiologic.lowlevel.repeat_if_cancelled()
, which, depending on the library, either has the same action or repeats the call until it completes (successfully or unsuccessfully). Previouslyanyio.CancelScope
was used, which did not really shield the call from cancellation in ways outside ofanyio
, such astask.cancel()
, so its use was abandoned. However,asyncio.shield()
starts a new task, which has a negative impact on performance and does not match the expected single-switch behavior. This is why repeat instead of shield was chosen. This change directly affectsaiologic.Condition
.
0.9.0
Changed
aiologic.CountdownEvent
is significantly improved. Instead of using the initial value for the representation, it now uses the current value, so that its state is saved when thepickle
module is used, just like the other events. Also added the ability to increase the current value by more than one per call, which should help with performance in some scenarios. The newclear()
method, which atomically resets the current value, has the same purpose.- Changed the detection of the current green library after applying the monkey patch. Now the library that applied the patch is set only for the main thread, and the default library (usually
threading
) is used for all others. This should eliminate redundancy when using worker threads, which previously had to explicitly setthreading
to avoid accidentally creating a new hub and hence an event loop.
0.8.1
0.8.0
0.7.1
0.7.0
Added
aiologic.Barrier
as a cyclic barrier, i.e. a barrier that tasks can pass through repeatedly (thread-aware alternative toasyncio.Barrier
).aiologic.SimpleQueue
as a simplified queue withoutmaxsize
support.aiologic.PriorityQueue
as a priority queue, i.e. a queue that returns its smallest element (using theheapq
module).
Changed
- Once again the queues have been significantly changed.
aiologic.Queue
and its derivatives now use a unique architecture that guarantees exclusive access to inherited methods without increasing the number of context switches: implicit lock and wait queue are combined. Overridable methods are now part of the public API, and fairness now covers all accesses. The properties returning the length of waiting queues have also been changed: a commonwaiting
property returning the number of all waiting ones has been added, andput_waiting
andget_waiting
have been renamed toputting
andgetting
.