Re: [go-nuts] Sync.wait()?

2020-02-10 Thread Jesper Louis Andersen
There are two Wait() methods in the sync package. One is on the type Cond and one is on the type WaitGroup. Assuming you mean waitgroup, the code uses the runtime call Semacquire which is a semaphore lock. In that case, you are not looping anymore, but waiting until said semaphore is released. It

[go-nuts] Sync.wait()?

2020-02-10 Thread Joe McGuckin
Various sources say wait() waits until the internal counter reaches zero. Does it cause a real pause (e.g.: control passing to another goroutine?) Looking at the code, it just seems to loop endlessly waiting for the counter to reach zero. Is that somehow optimized away? Sitting in a tight loop