Comment by superb_dev
5 days ago
`runtime.LockOSThread()` will pin the current goroutine to the os thread that its currently running on
5 days ago
`runtime.LockOSThread()` will pin the current goroutine to the os thread that its currently running on
Oooh, 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
And prevents other goroutines from running on that thread. I think that’s crucial.