On Mon, Sep 25, 2017 at 02:53:01PM +0100, Daniel P. Berrange wrote: > On Thu, Sep 14, 2017 at 02:41:12AM +0200, Wojtek Porczyk wrote: > > The intended use is to ensure that the implementation is empty, which is > > one way to ensure that all connections were properly closed and file > > descriptors reclaimed. > > > > Signed-off-by: Wojtek Porczyk <woju@xxxxxxxxxxxxxxxxxxxxxx> > > --- (snip) > > + @asyncio.coroutine > > + def drain(self): > > + '''Wait for the implementation to become idle. > > + > > + This is a coroutine. > > + ''' > > + self.log.debug('drain()') > > + if self._pending: > > + yield from self._finished.wait() > > + self.log.debug('drain ended') > > What is responsible for calling 'drain' ? Users of the library, and they do it at their pleasure. This is to allow the loop to actually run the scheduled tasks. After calling virConnect.close() the handles/timeouts aren't actually closed until the loop run the scheduled callbacks. In practice a simple `yield` in a coroutine would be also sufficient since respective Tasks are in the _ready queue and all run during next loop cycle, but that's not guaranteed in asyncio specification. -- pozdrawiam / best regards _.-._ Wojtek Porczyk .-^' '^-. Invisible Things Lab |'-.-^-.-'| | | | | I do not fear computers, | '-.-' | I fear lack of them. '-._ : ,-' -- Isaac Asimov `^-^-_>
Attachment:
signature.asc
Description: Digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list