We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Since the newline is added in an additional hPut call another thread might write to the handle in the meantime.
I think that's acceptable but should be documented.
-- | Write a ByteString to a handle, appending a newline byte hPutStrLn :: Handle -> ByteString -> IO () hPutStrLn h ps | length ps < 1024 = hPut h (ps `snoc` 0x0a) | otherwise = hPut h ps >> hPut h (singleton (0x0a)) -- don't copy
The text was updated successfully, but these errors were encountered:
Following https://www.snoyman.com/blog/2016/11/haskells-missing-concurrency-basics/, let's reopen this. I think the mitigation with length ps < 1024 = hPut h (ps snoc 0x0a) is both insufficient and inefficient.
length ps < 1024 = hPut h (ps
0x0a)
Sorry, something went wrong.
hPutStr
I am looking at the implementation of hPutStrLn and do not see an easy solution without copying. Perhaps, adding hPutStrLnAtomic is the solution.
hPutStrLn
hPutStrLnAtomic
A related discussion https://discourse.haskell.org/t/explain-ghc-internal-io-handle-text-hputstr/9389
Successfully merging a pull request may close this issue.
Since the newline is added in an additional hPut call another thread might write to the handle in the meantime.
I think that's acceptable but should be documented.
The text was updated successfully, but these errors were encountered: