Standard library / sync/atomic

atomic.Int64

A typed atomic int64 with a usable zero value. Do not copy after first use. Prefer typed atomics to raw pointer functions for new code. Expected stdout: '0\n3\n'.

Formal Syntax & Structure

go syntaxgo
type Int64 struct {}

Working Example

Example Snippetgo
package main
import (  "fmt"  "sync/atomic")
func main() { var x atomic.Int64; fmt.Println(x.Load()); x.Add(3); fmt.Println(x.Load()) }
Go Reference