def close(self):
"""Closes event log reader if open.
If the i/o thread is running, this method blocks until it has been
shut down.
Further reads are not permitted after this method is called.
Raises:
Exception: To propagate any exceptions that may have been thrown
by the close operation in the other thread. If an exception
is thrown, then all subsequent calls to this method will
rethrow that same exception.
"""
with self._lock:
if not self._is_closed:
self._is_closed = True
if not self._thread.is_alive():
self._reader = None
return
self._wake_up_producer.notify()
while self._reader is not None:
self._wake_up_consumers.wait()
if self._close_exception is not None:
six.reraise(*self._close_exception)
评论列表
文章目录