atomic demo

This commit is contained in:
xushiwei
2024-06-16 16:39:55 +08:00
parent 340b5bd165
commit 5416e92dbf
2 changed files with 12 additions and 29 deletions

View File

@@ -9,7 +9,7 @@ func main() {
var v int64
atomic.Store(&v, 100)
println("store:", atomic.Load(&v))
c.Printf(c.Str("store: %ld\n"), atomic.Load(&v))
atomic.Add(&v, 1)
c.Printf(c.Str("v: %ld\n"), v)