3 ms·
Likewise, with futures and executors I haven't had to touch threads directly for some time. They give you the tools to just say "go away and do these things",
by Nursie 6y ago
Likewise, with futures and executors I haven't had to touch threads directly for some time.
They give you the tools to just say "go away and do these things", which after years of dealing directly with pthreads in C was a breath of fresh air!
- thaumasiotes 6y agoBut compare this very recent submission: https://news.ycombinator.com/item?id=24921657 https://news.ycombinator.com/item?id=24921657 which presents threads as the solution to the pain of using futures.
- jaen 6y agoSTM is not a solution to the pain of futures, STM is a "solution" to the pain of properly using locks, in particular when the concurrency is very fine-grained. A future internally is just a value or a set of waiters. Whether they are "colored" (ie. can you wait on a future in a non-future context), or based on threads or cooperative concurrency (ie. async) etc. is entirely an implementation detail, with significantly differing trade-offs. In that sense, you can really only compare future implementations with other concurrency systems.