Skip to content

Tag: asynchronous

Can’t understand how D. Beazley monitor future in its code on concurrence

Trying to understand concurrency based on generators, I try to follow the talk by D. Beazley. I don’t understand the purpose of future_monitor and was wondering what are the consequence of taking the function out? Here is its implementation of asynchronous server and, right after, my implementation without the future_monitor function. Perhaps I misunderstand how future and add_done_callback act with

Using an asynchronous function in __del__

I’d like to define what essentially is an asynchronous __del__ that closes a resource. Here’s an example. This works, printing destructing and closing as expected. However, if the resource is defined outside an asynchronous function, __del__ is called, but closing is never performed. No warning is raised here, but the prints reveal that closing was […]