diff options
Diffstat (limited to 'bitbake/lib/bb/server')
| -rw-r--r-- | bitbake/lib/bb/server/process.py | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py index 76b189291d..ad4035a738 100644 --- a/bitbake/lib/bb/server/process.py +++ b/bitbake/lib/bb/server/process.py | |||
| @@ -321,7 +321,22 @@ class ProcessServer(): | |||
| 321 | bb.warn('Ignoring invalid BB_SERVER_TIMEOUT=%s, must be a float specifying seconds.' % self.timeout) | 321 | bb.warn('Ignoring invalid BB_SERVER_TIMEOUT=%s, must be a float specifying seconds.' % self.timeout) |
| 322 | seendata = True | 322 | seendata = True |
| 323 | 323 | ||
| 324 | ready = self.idle_commands(.1, fds) | 324 | if not self.idle: |
| 325 | self.idle = threading.Thread(target=self.idle_thread) | ||
| 326 | self.idle.start() | ||
| 327 | elif self.idle and not self.idle.is_alive(): | ||
| 328 | serverlog("Idle thread terminated, main thread exiting too") | ||
| 329 | bb.error("Idle thread terminated, main thread exiting too") | ||
| 330 | self.quit = True | ||
| 331 | |||
| 332 | nextsleep = 0.1 | ||
| 333 | if self.xmlrpc: | ||
| 334 | nextsleep = self.xmlrpc.get_timeout(nextsleep) | ||
| 335 | try: | ||
| 336 | ready = select.select(fds,[],[],nextsleep)[0] | ||
| 337 | except InterruptedError: | ||
| 338 | # Ignore EINTR | ||
| 339 | ready = [] | ||
| 325 | 340 | ||
| 326 | if self.idle: | 341 | if self.idle: |
| 327 | self.idle.join() | 342 | self.idle.join() |
| @@ -485,31 +500,6 @@ class ProcessServer(): | |||
| 485 | if nextsleep is not None: | 500 | if nextsleep is not None: |
| 486 | select.select(fds,[],[],nextsleep)[0] | 501 | select.select(fds,[],[],nextsleep)[0] |
| 487 | 502 | ||
| 488 | def idle_commands(self, delay, fds=None): | ||
| 489 | nextsleep = delay | ||
| 490 | if not fds: | ||
| 491 | fds = [] | ||
| 492 | |||
| 493 | if not self.idle: | ||
| 494 | self.idle = threading.Thread(target=self.idle_thread) | ||
| 495 | self.idle.start() | ||
| 496 | elif self.idle and not self.idle.is_alive(): | ||
| 497 | serverlog("Idle thread terminated, main thread exiting too") | ||
| 498 | bb.error("Idle thread terminated, main thread exiting too") | ||
| 499 | self.quit = True | ||
| 500 | |||
| 501 | if nextsleep is not None: | ||
| 502 | if self.xmlrpc: | ||
| 503 | nextsleep = self.xmlrpc.get_timeout(nextsleep) | ||
| 504 | try: | ||
| 505 | return select.select(fds,[],[],nextsleep)[0] | ||
| 506 | except InterruptedError: | ||
| 507 | # Ignore EINTR | ||
| 508 | return [] | ||
| 509 | else: | ||
| 510 | return select.select(fds,[],[],0)[0] | ||
| 511 | |||
| 512 | |||
| 513 | class ServerCommunicator(): | 503 | class ServerCommunicator(): |
| 514 | def __init__(self, connection, recv): | 504 | def __init__(self, connection, recv): |
| 515 | self.connection = connection | 505 | self.connection = connection |
