Just implement generics already. Sheesh. https://github.com/google/gvisor/blob/master/tools/go_generics/generics.go …
Yeah, there should probably be something to prevent holding MutexGuard over yield points. Could be a lint. cc @aaron_turon — maybe you’ve already thought of a solution here.
-
-
I should also mention that the starvation issue has been discussed a lot, and years ago there was a rough consensus to spin up more threads to prevent starvation. Not sure if that has changed. BTW, Go has the same issue with cgo threads and uses this technique.
-
That kind of lint would be defeated by any abstraction boundary that has a mutex internally. Unless you track "could block" at the type-system level. Also, there are lots of things that block thread pools, mutexes are just one example.
- 2 more replies
New conversation -
-
-
Even if it worked, I don't think that would be a very good lint. You don't *want* people to hold onto a mutex if it's blocking inside an asynchronous block, you want it to yield. Spinning up new threads definitely solves it, but then why use asnychronous I/O at all?
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.