Skip to content

Releases: x42005e1f/aiologic

0.13.1

24 Jan 15:52
517b4fd
Compare
Choose a tag to compare

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

19 Jan 13:15
039f6ae
Compare
Choose a tag to compare

Added

  • Type annotations via stubs. They are tested via mypy and pyright, 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

14 Dec 05:30
5042457
Compare
Choose a tag to compare

Changed

  • Support for cancellation and timeouts has been dramatically improved. The cancel() method (and accompanying is_cancelled()) has been added to low-level events, which always returns True after the first successful call before set() and False otherwise. Previously, cancellation handling used the same set() call, which resulted in false negatives, in particular unnecessary wakes.

Fixed

  • Added missing await keyword in aiologic.Condition, without which it did not restore the state of the wrapped aiologic.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

08 Nov 14:44
54d0b3d
Compare
Choose a tag to compare

Added

  • aiologic.lowlevel.async_checkpoint() as an alias for aiologic.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 as threading.Lock has been added. Passing another instance of aiologic.Condition is now supported too, and implies copying a reference to its lock. Also, passing None now specifies a different behavior whereby aiologic.Condition acts as lockless: its methods ignore the lock, which should help to use aiologic.Condition as a simple replacement for removed aiologic.ParkingLot.

0.10.0

04 Nov 01:36
e871010
Compare
Choose a tag to compare

Changed

  • aiologic.lowlevel.shield() function, which protects the call from cancellation, has been replaced by aiologic.lowlevel.repeat_if_cancelled(), which, depending on the library, either has the same action or repeats the call until it completes (successfully or unsuccessfully). Previously anyio.CancelScope was used, which did not really shield the call from cancellation in ways outside of anyio, such as task.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 affects aiologic.Condition.

0.9.0

02 Nov 18:27
9e5df22
Compare
Choose a tag to compare

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 the pickle 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 new clear() 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 set threading to avoid accidentally creating a new hub and hence an event loop.

0.8.1

30 Oct 16:37
c3df65c
Compare
Choose a tag to compare

Fixed

  • The future used by the asyncio event could be canceled due to the event loop shutdown, causing InvalidStateError to be raised due to the callback execution. In particular, this was detected when using call_soon() for notification methods.

0.8.0

26 Oct 09:41
6eee9ed
Compare
Choose a tag to compare

Added

  • aiologic.CountdownEvent as a countdown event, i.e. an event that wakes up all tasks when its value is down to zero (inspired by CountdownEvent from .NET Framework 4.0).
  • aiologic.RCapacityLimiter as a reentrant version of aiologic.CapacityLimiter.

0.7.1

20 Oct 21:49
623f632
Compare
Choose a tag to compare

Fixed

  • aiologic.Condition was referring to the wrong variable in its notification methods, which caused hangs (0.2.0 regression).

0.7.0

19 Oct 13:46
019881a
Compare
Choose a tag to compare

Added

  • aiologic.Barrier as a cyclic barrier, i.e. a barrier that tasks can pass through repeatedly (thread-aware alternative to asyncio.Barrier).
  • aiologic.SimpleQueue as a simplified queue without maxsize support.
  • aiologic.PriorityQueue as a priority queue, i.e. a queue that returns its smallest element (using the heapq 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 common waiting property returning the number of all waiting ones has been added, and put_waiting and get_waiting have been renamed to putting and getting.