Skip to content

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

 
 
 

Contributors

Languages