Skip to main content
The event loops that are closing, and the refusal every owner of a loop-bound resource raises on one. A loop is closing once the code that ends it has marked it so, at the start of its end, before it awaits the release of the loop’s resources (close does; release_loop_bound_resources itself marks nothing, since a loop that lives on leases anew after a release). From then on every owner the kit keeps per loop (the pooled clients, the resource registries) refuses a new lease on that loop with RuntimeError, as a closed connection pool refuses a new connection: a resource the release has already passed would otherwise be opened anew and stay open past the loop’s close. A lease held before the mark keeps working until it is released. A loop stays closing for the rest of its life; the mark drops with the loop. The set is reached from every thread that runs a loop, so it is read and written under a lock.

mark_loop_closing

tai42_kit.loop_closing.mark_loop_closing
Mark loop as closing: every owner of a loop-bound resource refuses a new lease on it from now on. Parameters

loop_is_closing

tai42_kit.loop_closing.loop_is_closing
Whether loop has been marked closing. Parameters

refuse_lease_on_closing_loop

tai42_kit.loop_closing.refuse_lease_on_closing_loop
Raise RuntimeError when loop is closing, naming owner and the lease it refuses. Parameters