summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>2016-04-27 15:21:52 +0000
committerMichael Haubenwallner <haubi@gentoo.org>2017-01-16 11:00:38 +0100
commit077e60fb9c46247fc053df29b9416b46c90ae6c7 (patch)
treeec4bb0185c40db86ae8384eb14b53ab23f22ffaa /eclass/multiprocessing.eclass
parentsys-libs/zlib: Bump to version 1.2.11 (diff)
downloadgentoo-077e60fb9c46247fc053df29b9416b46c90ae6c7.tar.gz
gentoo-077e60fb9c46247fc053df29b9416b46c90ae6c7.tar.bz2
gentoo-077e60fb9c46247fc053df29b9416b46c90ae6c7.zip
multiprocessing.eclass: work around Cygwin FIFO shortcoming
Cygwin does not support multiple read-handles for one FIFO (yet). As we really need just one readonly- and one writeonly-handle, we can reorder to open one single readwrite- and one writeonly-handle. X-Gentoo-Bug: 583962 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=583962
Diffstat (limited to 'eclass/multiprocessing.eclass')
-rw-r--r--eclass/multiprocessing.eclass9
1 files changed, 7 insertions, 2 deletions
diff --git a/eclass/multiprocessing.eclass b/eclass/multiprocessing.eclass
index 70ca475a8c72..67f7e2d65b42 100644
--- a/eclass/multiprocessing.eclass
+++ b/eclass/multiprocessing.eclass
@@ -139,11 +139,16 @@ multijob_init() {
# Setup a pipe for children to write their pids to when they finish.
# We have to allocate two fd's because POSIX has undefined behavior
- # when you open a FIFO for simultaneous read/write. #487056
+ # when using one single fd for both read and write. #487056
+ # However, opening an fd for read or write only will block until the
+ # opposite end is opened as well. Thus we open the first fd for both
+ # read and write to not block ourselve, but use it for reading only.
+ # The second fd really is opened for write only, as Cygwin supports
+ # just one single read fd per FIFO. #583962
local pipe="${T}/multijob.pipe"
mkfifo -m 600 "${pipe}"
- redirect_alloc_fd mj_write_fd "${pipe}"
redirect_alloc_fd mj_read_fd "${pipe}"
+ redirect_alloc_fd mj_write_fd "${pipe}" '>'
rm -f "${pipe}"
# See how many children we can fork based on the user's settings.