Re: [External] Re: [go-nuts] channels as trylocks

2019-07-25 Thread 'Shivaram Lingamneni' via golang-nuts
On Thu, Jul 25, 2019 at 1:44 AM Ian Lance Taylor wrote: > > On Wed, Jul 24, 2019 at 11:24 AM shivaram via golang-nuts > wrote: > > > > Several sources, including this issue comment: > > > > https://github.com/golang/go/issues/27544#issuecomment-419265234 > > > > state that a buffered channel of s

Re: [go-nuts] channels as trylocks

2019-07-24 Thread Ian Lance Taylor
On Wed, Jul 24, 2019 at 11:24 AM shivaram via golang-nuts wrote: > > Several sources, including this issue comment: > > https://github.com/golang/go/issues/27544#issuecomment-419265234 > > state that a buffered channel of size 1 can be used as a trylock by > select'ing on it with a default case.

[go-nuts] channels as trylocks

2019-07-24 Thread shivaram via golang-nuts
Several sources, including this issue comment: https://github.com/golang/go/issues/27544#issuecomment-419265234 state that a buffered channel of size 1 can be used as a trylock by select'ing on it with a default case. I was thinking about it and it seemed to me that with such an implementation