demo: c atomic

This commit is contained in:
xushiwei
2024-06-16 15:20:29 +08:00
parent b5507f79e4
commit f7c322c311
2 changed files with 10 additions and 7 deletions

View File

@@ -15,4 +15,7 @@ func main() {
sync.CompareAndXchg(&v, 101, 102)
c.Printf(c.Str("%ld\n"), v)
sync.FetchAndSub(&v, 1)
c.Printf(c.Str("%ld\n"), v)
}