Skip to content

Andrew-M-C/go.atomicbool

Repository files navigation

go.atomicbool

Build Status GoDoc Coverage Status Go Report Card

An atomic Go boolean type with function interfaces like official sync/atomic.

Example:

Playground

package main

import (
	"fmt"
	"github.com/Andrew-M-C/go.atomicbool"
)

func main() {
	f := fmt.Println

	b := atomicbool.New(true)
	f(b.Load())

	b.Store(false)
	f(b.Load())

	swapped := b.CompareAndSwap(false, true)
	f(swapped, b.Load())
}

About

An atomic Go boolean type with function interfaces like official sync/atomic

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages