summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/server
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-12-29 14:56:14 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-12-31 17:05:17 +0000
commitc4ecfc4dc5511a23e12ed68eb140a67fd4181127 (patch)
tree46586a8cfdac78f493d58a835b1d6009b8d13c4d /bitbake/lib/bb/server
parentff2d778f6d33a4e48406f7bbc7fdbc4e95113069 (diff)
downloadpoky-c4ecfc4dc5511a23e12ed68eb140a67fd4181127.tar.gz
bitbake: server/process: Improve idle loop exit code
When idle handlers want to exit, returning "False" isn't very clear and also causes challenges with the ordering of the removing the idle handler and marking that no async command is running. Use a specific class to signal the exit condition allowing clearer code and allowing the async command to be cleared after the handler has been removed, reducing any opportunity for races. (Bitbake rev: 102e8d0d4c5c0dd8c7ba09ad26589deec77e4308) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/server')
-rw-r--r--bitbake/lib/bb/server/process.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py
index eba28ad983..5acc105e08 100644
--- a/bitbake/lib/bb/server/process.py
+++ b/bitbake/lib/bb/server/process.py
@@ -71,6 +71,10 @@ def get_lockfile_process_msg(lockfile):
71 return procs.decode("utf-8") 71 return procs.decode("utf-8")
72 return None 72 return None
73 73
74class idleFinish():
75 def __init__(self, msg):
76 self.msg = msg
77
74class ProcessServer(): 78class ProcessServer():
75 profile_filename = "profile.log" 79 profile_filename = "profile.log"
76 profile_processed_filename = "profile.log.processed" 80 profile_processed_filename = "profile.log.processed"
@@ -361,7 +365,12 @@ class ProcessServer():
361 for function, data in list(self._idlefuns.items()): 365 for function, data in list(self._idlefuns.items()):
362 try: 366 try:
363 retval = function(self, data, False) 367 retval = function(self, data, False)
364 if retval is False: 368 if isinstance(retval, idleFinish):
369 serverlog("Removing idle function %s at idleFinish" % str(function))
370 del self._idlefuns[function]
371 self.cooker.command.finishAsyncCommand(retval.msg)
372 nextsleep = None
373 elif retval is False:
365 serverlog("Removing idle function %s" % str(function)) 374 serverlog("Removing idle function %s" % str(function))
366 del self._idlefuns[function] 375 del self._idlefuns[function]
367 nextsleep = None 376 nextsleep = None