diff options
author | Gabor Greif <ggreif@gmail.com> | 2020-01-22 18:24:14 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-01-25 05:19:07 -0500 |
commit | ad4eb7a76f6f1fb18e3ea47665feb3a9893427de (patch) | |
tree | 6586f95d1e14baffb2be7321ef59c2a9faae0c0e | |
parent | 738e2912bfa2122074630d38693a260e4b58aeaf (diff) | |
download | haskell-ad4eb7a76f6f1fb18e3ea47665feb3a9893427de.tar.gz |
Document the fact, that openFileBlocking can consume an OS thread indefinitely.
Also state that a deadlock can happen with the non-threaded runtime.
[ci skip]
-rw-r--r-- | libraries/base/GHC/IO/Handle/FD.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libraries/base/GHC/IO/Handle/FD.hs b/libraries/base/GHC/IO/Handle/FD.hs index 64179768c9..122331f17d 100644 --- a/libraries/base/GHC/IO/Handle/FD.hs +++ b/libraries/base/GHC/IO/Handle/FD.hs @@ -150,6 +150,11 @@ openFile fp im = -- This can be useful for opening a FIFO for writing: if we open in -- non-blocking mode then the open will fail if there are no readers, -- whereas a blocking open will block until a reader appear. +-- +-- Note: when blocking happens, an OS thread becomes tied up with the +-- processing, so the program must have at least another OS thread if +-- it wants to unblock itself. By corollary, a non-threaded runtime +-- will need a process-external trigger in order to become unblocked. -- -- @since 4.4.0.0 openFileBlocking :: FilePath -> IOMode -> IO Handle |