package main

import (
	"fmt"
	"sync/atomic"
)

func main() {
	var value int64 = 0

	success := atomic.CompareAndSwapInt64(&value, 0, 42)
	fmt.Println("第一次 CAS 是否成功:", success, "当前值:", value)

	success = atomic.CompareAndSwapInt64(&value, 0, 100)
	fmt.Println("第二次 CAS 是否成功:", success, "当前值:", value)
}
