summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2024-11-05 15:02:26 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-11-07 13:36:04 +0000
commitf8f45ebde4ffa60ec1777976cb8b0020cdc11929 (patch)
treefce31088e567802ef9108d183f55fa1b96889b06 /bitbake/lib/bb
parent79f193ffa0394301242d25800a715b970c2a0b95 (diff)
downloadpoky-f8f45ebde4ffa60ec1777976cb8b0020cdc11929.tar.gz
bitbake: server/process: Merge a function to simplfy code
Keeping this code separate just makes the code harder to understand, merge them. (Bitbake rev: e5ac26a0e1779df1da3277bf48899c8f7642f1f8) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/server/process.py42
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
513class ServerCommunicator(): 503class ServerCommunicator():
514 def __init__(self, connection, recv): 504 def __init__(self, connection, recv):
515 self.connection = connection 505 self.connection = connection