Quantcast
Channel: Are increment operators in Go atomic on x86? - Stack Overflow
Browsing all 2 articles
Browse latest View live

Answer by Stephen Weinberg for Are increment operators in Go atomic on x86?

No, increment should never be assumed to be atomic. Use the atomic addition functions or a mutex.Lets assume:import "sync/atomic"var counter = new(int32)One goroutine could do atomic.AddInt32(counter,...

View Article



Are increment operators in Go atomic on x86?

Here's some background:I need a counter variable shared between go routines, used for something like a leaky-bucket. I know there's an example of leaky-bucket in Effective Go, concurrent section, but...

View Article
Browsing all 2 articles
Browse latest View live




Latest Images