bitbake: utils.py: Add function to set nonblocking operation on a file descriptor
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 22 Jun 2012 11:53:16 +0000 (12:53 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 25 Jun 2012 13:57:16 +0000 (14:57 +0100)
(Bitbake rev: ab6d71ebfcfb7bedc064b25f84647c8815096e5a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/lib/bb/runqueue.py
bitbake/lib/bb/utils.py

index 608aff8..bd643ea 100644 (file)
@@ -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
 
index fc389a3..77ad39e 100644 (file)
@@ -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)
+