aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-06-22 12:53:16 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-06-25 14:13:35 +0100
commitab6d71ebfcfb7bedc064b25f84647c8815096e5a (patch)
tree5deffc8aa534ea8062222bcc9df9881ffa54503c
parent3aeb268b2aaab4bb8b1cfff1450e0b76aa8ce855 (diff)
downloadbitbake-ab6d71ebfcfb7bedc064b25f84647c8815096e5a.tar.gz
bitbake-ab6d71ebfcfb7bedc064b25f84647c8815096e5a.tar.bz2
bitbake-ab6d71ebfcfb7bedc064b25f84647c8815096e5a.zip
utils.py: Add function to set nonblocking operation on a file descriptor
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/runqueue.py2
-rw-r--r--lib/bb/utils.py5
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py
index 608aff8a..bd643ea7 100644
--- a/lib/bb/runqueue.py
+++ b/lib/bb/runqueue.py
@@ -1724,7 +1724,7 @@ class runQueuePipe():
def __init__(self, pipein, pipeout, d):
self.input = pipein
pipeout.close()
- fcntl.fcntl(self.input, fcntl.F_SETFL, fcntl.fcntl(self.input, fcntl.F_GETFL) | os.O_NONBLOCK)
+ bb.utils.nonblockingfd(self.input)
self.queue = ""
self.d = d
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index fc389a3e..77ad39ee 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -26,6 +26,7 @@ import logging
import bb
import bb.msg
import multiprocessing
+import fcntl
from commands import getstatusoutput
from contextlib import contextmanager
@@ -754,3 +755,7 @@ def contains(variable, checkvalues, truevalue, falsevalue, d):
def cpu_count():
return multiprocessing.cpu_count()
+
+def nonblockingfd(fd):
+ fcntl.fcntl(fd, fcntl.F_SETFL, fcntl.fcntl(fd, fcntl.F_GETFL) | os.O_NONBLOCK)
+