Skip to content
/ atomic Public

Package atomic provides low-level atomic memory primitives useful for implementing synchronization algorithms.

License

Notifications You must be signed in to change notification settings

hslam/atomic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

atomic

PkgGoDev Build Status codecov Go Report Card LICENSE

Package atomic provides low-level atomic memory primitives useful for implementing synchronization algorithms.

Feature

  • Int8
  • Int16
  • Int32
  • Int64
  • Uint8
  • Uint16
  • Uint32
  • Uint64
  • Uintptr
  • Pointer
  • Float32
  • Float64
  • Bool
  • String
  • Bytes
  • Value

Get started

Install

go get github.com/hslam/atomic

Import

import "github.com/hslam/atomic"

Usage

Example

package main

import (
	"fmt"
	"github.com/hslam/atomic"
)

func main() {
	str := atomic.NewString("")
	str.Store("Hi")
	str.Swap("Hello")
	str.Add(" atomic")
	str.CompareAndSwap("Hello atomic", "Hello World")
	fmt.Println(str.Load())
}

Output

Hello World

License

This package is licensed under a MIT license (Copyright (c) 2020 Meng Huang)

Author

atomic was written by Meng Huang.

About

Package atomic provides low-level atomic memory primitives useful for implementing synchronization algorithms.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages