summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/server
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/server')
-rw-r--r--bitbake/lib/bb/server/process.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py
index 7c587a9110..ce53fdc678 100644
--- a/bitbake/lib/bb/server/process.py
+++ b/bitbake/lib/bb/server/process.py
@@ -20,6 +20,7 @@ import os
20import sys 20import sys
21import time 21import time
22import select 22import select
23import signal
23import socket 24import socket
24import subprocess 25import subprocess
25import errno 26import errno
@@ -737,11 +738,28 @@ class ConnectionWriter(object):
737 # Why bb.event needs this I have no idea 738 # Why bb.event needs this I have no idea
738 self.event = self 739 self.event = self
739 740
740 def send(self, obj): 741 def _send(self, obj):
741 obj = multiprocessing.reduction.ForkingPickler.dumps(obj)
742 with self.wlock: 742 with self.wlock:
743 self.writer.send_bytes(obj) 743 self.writer.send_bytes(obj)
744 744
745 def send(self, obj):
746 obj = multiprocessing.reduction.ForkingPickler.dumps(obj)
747 # See notes/code in CookerParser
748 # We must not terminate holding this lock else processes will hang.
749 # For SIGTERM, raising afterwards avoids this.
750 # For SIGINT, we don't want to have written partial data to the pipe.
751 # pthread_sigmask block/unblock would be nice but doesn't work, https://bugs.python.org/issue47139
752 process = multiprocessing.current_process()
753 if process and hasattr(process, "queue_signals"):
754 with process.signal_threadlock:
755 process.queue_signals = True
756 self._send(obj)
757 process.queue_signals = False
758 for sig in process.signal_received.pop():
759 process.handle_sig(sig, None)
760 else:
761 self._send(obj)
762
745 def fileno(self): 763 def fileno(self):
746 return self.writer.fileno() 764 return self.writer.fileno()
747 765