15 from . import config |
15 from . import config |
16 from . import repository |
16 from . import repository |
17 from .dreamtime import MonotonicTime, DreamTime, RealTime |
17 from .dreamtime import MonotonicTime, DreamTime, RealTime |
18 from .instance import BorgInstance |
18 from .instance import BorgInstance |
19 from .scheduler import TerminableThread |
19 from .scheduler import TerminableThread |
|
20 from .exprotect import protect_noreturn |
20 |
21 |
21 _logger=logging.getLogger(__name__) |
22 _logger=logging.getLogger(__name__) |
22 |
23 |
23 JOIN_TIMEOUT=10 |
24 JOIN_TIMEOUT=10 |
24 |
25 |
292 |
293 |
293 def __block_when_running(self): |
294 def __block_when_running(self): |
294 running=self.is_running() |
295 running=self.is_running() |
295 assert(not running) |
296 assert(not running) |
296 |
297 |
|
298 @protect_noreturn |
297 def __log_listener(self): |
299 def __log_listener(self): |
298 self.logger.debug('Log listener thread waiting for entries') |
300 self.logger.debug('Log listener thread waiting for entries') |
299 success=True |
301 success=True |
300 for msg in iter(self.borg_instance.read_log, None): |
302 for msg in iter(self.borg_instance.read_log, None): |
301 self.logger.debug(str(msg)) |
303 self.logger.debug(str(msg)) |
383 |
385 |
384 self.borg_instance.wait() |
386 self.borg_instance.wait() |
385 |
387 |
386 self.logger.debug('Borg subprocess terminated; terminating log listener thread') |
388 self.logger.debug('Borg subprocess terminated; terminating log listener thread') |
387 |
389 |
|
390 @protect_noreturn |
388 def __result_listener(self): |
391 def __result_listener(self): |
389 self.logger.debug('Result listener thread waiting for result') |
392 self.logger.debug('Result listener thread waiting for result') |
390 |
393 |
391 res=self.borg_instance.read_result() |
394 res=self.borg_instance.read_result() |
392 |
395 |
543 self.current_operation=None |
546 self.current_operation=None |
544 self.thread_res=None |
547 self.thread_res=None |
545 self.thread_log=None |
548 self.thread_log=None |
546 self.borg_instance=None |
549 self.borg_instance=None |
547 |
550 |
|
551 @protect_noreturn |
548 def __main_thread(self): |
552 def __main_thread(self): |
549 with self._cond: |
553 with self._cond: |
550 while not self._terminate: |
554 while not self._terminate: |
551 try: |
555 try: |
552 assert(not self.current_operation) |
556 assert(not self.current_operation) |