News for hackers. Stuff that matters.
Re:Goroutines: The concurrency model we wanted all along by synthetigram on Friday July 07, 2023 @05:07PM (#36638302)
The StreamObserver API came at a time (2015) when it seems liked RxJava was going to take over. That didn't end up happening, but the API is still around. While it is more cumbersome, some things are /impossible/ to do with the Go style blocking. For example, try cancelling out of a Recv() call. The only way is to tear the entire Stream down. Goroutines never successfully married select {} and sync.Cond, or context Cancel. These are needed to successfully back out of a blocking statement. Unfortunately, that can't be done, and a goroutine that blocks is really stuck there. The only saving grace is that goroutines are relatively cheap (2-4K of memory?), and it's okay if a few O(100K) of them get stuck.
Re:Goroutines: The concurrency model we wanted all along by dfawcus on Sunday July 09, 2023 @06:22PM (#36659580)
As I recall, cancelling out of a Recv() as in a network read can be achieved by setting an expiry time in the past.

i.e. on a net.Conn one can use SetReadDeadline() to unblock/cancel a Read().