On Tue, Nov 29, 2016 at 9:51 AM, Roger Alsing <rogerals...@gmail.com> wrote: > Coming from C++/C# background where locks/mutexes are considered evil due to > blocking threads. > Due to how the Go goroutine scheduler works, are the Go counterpart of those > primitives "different"? > > Should I see the Go variants of these primitives more like yield points > where the execution of a goroutine yields to let other goroutines run. > And thus not resulting in the same resource code/weight as the primitives > has in other languages?
Yes. A Go sync.Mutex blocks a goroutine, not a thread. Goroutines are lighter weight than threads--they are basically just a stack. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.