diff options
| author | Richard Purdie <rpurdie@linux.intel.com> | 2010-01-21 23:46:20 +0000 |
|---|---|---|
| committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-01-21 23:46:20 +0000 |
| commit | 5c62833766048b83c0d7ea9e77194b9ca6af7fb1 (patch) | |
| tree | 960a3030ecff5fc41fd6398474a60556834d0b6b /bitbake/lib/bb/runqueue.py | |
| parent | fd42ffa273396b3ba425fe34cc43b62d540187fe (diff) | |
| download | poky-5c62833766048b83c0d7ea9e77194b9ca6af7fb1.tar.gz | |
runqueue.py: Use fcntl to make the worker pipes non-blocking
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/runqueue.py')
| -rw-r--r-- | bitbake/lib/bb/runqueue.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index 7a34ba9f7e..1f9907b9d5 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py | |||
| @@ -26,6 +26,7 @@ from bb import msg, data, event, mkdirhier, utils | |||
| 26 | import bb, os, sys | 26 | import bb, os, sys |
| 27 | import signal | 27 | import signal |
| 28 | import stat | 28 | import stat |
| 29 | import fcntl | ||
| 29 | 30 | ||
| 30 | class TaskFailure(Exception): | 31 | class TaskFailure(Exception): |
| 31 | """Exception raised when a task in a runqueue fails""" | 32 | """Exception raised when a task in a runqueue fails""" |
| @@ -1161,12 +1162,16 @@ class runQueuePipe(): | |||
| 1161 | def __init__(self, pipein, pipeout, d): | 1162 | def __init__(self, pipein, pipeout, d): |
| 1162 | self.fd = pipein | 1163 | self.fd = pipein |
| 1163 | os.close(pipeout) | 1164 | os.close(pipeout) |
| 1165 | fcntl.fcntl(self.fd, fcntl.F_SETFL, fcntl.fcntl(self.fd, fcntl.F_GETFL) | os.O_NONBLOCK) | ||
| 1164 | self.queue = "" | 1166 | self.queue = "" |
| 1165 | self.d = d | 1167 | self.d = d |
| 1166 | 1168 | ||
| 1167 | def read(self): | 1169 | def read(self): |
| 1168 | start = len(self.queue) | 1170 | start = len(self.queue) |
| 1169 | self.queue = self.queue + os.read(self.fd, 1024) | 1171 | try: |
| 1172 | self.queue = self.queue + os.read(self.fd, 1024) | ||
| 1173 | except OSError: | ||
| 1174 | pass | ||
| 1170 | end = len(self.queue) | 1175 | end = len(self.queue) |
| 1171 | index = self.queue.find("</event>") | 1176 | index = self.queue.find("</event>") |
| 1172 | while index != -1: | 1177 | while index != -1: |
