Comments (2)
Correct me if I'm wrong but this is exactly the same behaviour as you'll get with hPutStr for String
. Try it with long enough strings, or go look at the impl, it also releases the Handle
lock. In fact, last time I checked the Handle
code, it goes to quite some lengths to make sure that it is not evaluating arbitrary user thunks while it is holding the Handle
lock.
In other words, this would be the expected behaviour. Given that evaluating the next chunk can take arbitrary time, releasing the handle lock and allowing interleaving seems like the right thing to do. Are there compelling reasons we'd want to change that?
If you really want to write multiple streams to one Handle concurrently without any coordination, you can at least control the chunk boundaries. But I'd suggest the better approach is to use your own MVar
in your app. Then you're also responsible for making sure the lock is released if one of the writers goes off and sleeps while evaluating the next chunk.
from bytestring.
I get your point. The one reason I can come up with for changing the behavior is "it is closer to what the strict hPut
does". I think I ended up going for an MVar, which is probably the easiest solution. I opened #82 which documents the current behavior. I think it can be useful. No hard feelings if you decline or reword it.
from bytestring.
Related Issues (20)
- Uncons should not produce thunks HOT 1
- Add to splitWith documentation HOT 2
- Request for clarification in Builder.customStrategy docs HOT 1
- Tests for `LazyByteString` invariants are missing
- NFData instance for lazy bytestrings does not force evaluation of chunk contents HOT 1
- 0.12.0.0 release planning HOT 13
- Test that our rewrite rules and list fusion actually work HOT 1
- Invalid UTF-8 byte sequence is accepted as valid UTF-8 by text-2.0.1 HOT 8
- hGet documentation on return type is incorrect HOT 1
- CI arm jobs stay queued forever HOT 3
- Enable warnings in our C code
- Remove strict aliasing violations from our C code
- Test that `StrictByteString` results can be unboxed
- Data.ByteString.Char8.readDouble? HOT 4
- Use of `__builtin_ctzll` can cause runtime linker issues HOT 4
- is_valid_utf8 assumes avx2 support implies avx support HOT 6
- bytestring-0.11.5.1 (ghc-9.4.6) fails to build on Fedora HOT 4
- isValidUtf8 is broken HOT 4
- Compatibility with GHC's JavaScript backend HOT 1
- Overhaul Data.ByteString.Builder.RealFloat HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bytestring.