Skip to content

nightlyone/atomic

Repository files navigation

atomic

Atomic operations as methods on types

Go Reference Build Status

example usage

package main

import (
	"fmt"

	"github.com/nightlyone/atomic"
)

type Service struct {
	Health atomic.Bool
}

func main() {
	service := new(Service)
	isHealthy := service.Health.Value()
	fmt.Printf("service is healthy? %t\n", isHealthy)
	// Output: service is healthy? false
}

LICENSE

BSD-3-Clause

Contributing

Pull requests and github issues welcome.