4 ms·
`runtime.LockOSThread()` will pin the current goroutine to the os thread that its currently running on
by superb_dev 1y ago
`runtime.LockOSThread()` will pin the current goroutine to the os thread that its currently running on
- tuetuopay 1y agoOooh, that's what is happening. I assumed it locked some structure about the thread while touching it, to prevent races with the runtime. That's what I get for not RTFM'ing (in fairness, why Lock and not Pin, when both of these words have pretty well defined meanings in programming?) Thank you
- Someone 1y agoAnd prevents other goroutines from running on that thread. I think that’s crucial.