2 ms·
The same problem comes up at the end with the proposed `#[blocking]` solution. There is no formal definition of blocking outside of async. It's a colloquial ter
by dcow 2y ago
The same problem comes up at the end with the proposed `#[blocking]` solution. There is no formal definition of blocking outside of async. It's a colloquial term meaning "takes a relatively longer time to finish". Async is the formalization of making a distinction between grinding the cpu and yielding until something else wakes you up and tells you to keep going.
So I guess a well formed Future always adds yield points between hot loops? And then you just trust the runtime to manage execution context such that your yields are noops if there's no contention for execution time and/or to avoid needless context switching.
- CJefferson 2y agoThis sounds like the same kind of problem the Linux kernel is trying to get rid of, and we used to live with back in Windows 3. It’s very hard to put in enough yield points to never block for too long in a complex algorithm, and I was so happy when I stopped having to do that myself!