4 ms·
Nitpick: goroutine context switch can also happen at function calls (when the stack is being enlarged).
by robryk 12y ago
Nitpick: goroutine context switch can also happen at function calls (when the stack is being enlarged).
- Rapzid 12y agoI guess taking advantage of that could be tricky. If your function gets inlined...D'oh!
- skj 12y agoIf your function is inlined (which happens at compile time), then there won't be any stack growth and the point is moot.
- Rapzid 12y agoThis is a form of pre-emptive scheduling. It doesn't happen when the stack size needs to increase, it causes the stack check to fail. A bit of classic Dmitry cleverness: https://docs.google.com/document/d/1ETuA2IOmnaQ4j81AtTGT40Y4_Jr6_IDASEKg0t0dBR8/edit https://docs.google.com/document/d/1ETuA2IOmnaQ4j81AtTGT40Y4... http://golang.org/doc/go1.2#preemption http://golang.org/doc/go1.2#preemption Anyway, I was just offering this scenario up as a bit of curious humour where somebody might think they are providing an escape hatch but the compiler in-lines their call foiling their plans :)
- stcredzero 12y agoCurious humor == Classic too clever by half.