summaryrefslogtreecommitdiff
path: root/pod/perlfunc.pod
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-02-15 16:33:24 -0800
committerFather Chrysostomos <sprout@cpan.org>2011-02-15 16:34:22 -0800
commit2e0cfa16dea85dd33fe3cbf38f3324f4a8418181 (patch)
tree5189c0767046a1d431bd10c87d9b34efbed4ea04 /pod/perlfunc.pod
parentc222ef4643569ab52b77652219561edee7a72409 (diff)
downloadperl-2e0cfa16dea85dd33fe3cbf38f3324f4a8418181.tar.gz
[perl #78494] Pipes cause threads to hang on join()
or on close() in either thread. close() in one thread blocks until close() is called in the other thread, because both closes are waiting for the child process to end. Since we have a reference-counting mechanism for the underlying fileno, we can use that to determine whether close() should wait. This does not solve the problem of close $OUT block when it has been duplicated via open $OUT2, ">&" and $OUT2 is still in scope.
Diffstat (limited to 'pod/perlfunc.pod')
-rw-r--r--pod/perlfunc.pod4
1 files changed, 4 insertions, 0 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index d85b3d7fd0..2047dd6047 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -910,6 +910,10 @@ on the pipe to exit--in case you wish to look at the output of the pipe
afterwards--and implicitly puts the exit status value of that command into
C<$?> and C<${^CHILD_ERROR_NATIVE}>.
+If there are multiple threads running, C<close> on a filehandle from a
+piped open returns true without waiting for the child process to terminate,
+if the filehandle is still open in another thread.
+
Closing the read end of a pipe before the process writing to it at the
other end is done writing results in the writer receiving a SIGPIPE. If
the other end can't handle that, be sure to read all the data before