Prashant Varanasi e81582a97d Revert "Optimization for String.Store("")" (#32)
This optimization causes data races since we're changing the value field
without using atomics. E.g., a caller who has multiple goroutines
calling `Set("1")` and `Set("")` will race on the access to `s.v` since
one goroutine is trying to read it while the other sets it, neither
using atomic operations.

This reverts commit 16b44f14f0.
2017-11-14 08:16:11 -08:00
2017-08-29 15:32:23 -07:00
2016-10-27 00:33:41 -07:00
2016-10-27 00:33:41 -07:00
2017-04-10 17:14:58 -07:00
2017-07-19 18:46:50 -04:00

atomic GoDoc Build Status Coverage Status Go Report Card

Simple wrappers for primitive types to enforce atomic access.

Installation

go get -u go.uber.org/atomic

Usage

The standard library's sync/atomic is powerful, but it's easy to forget which variables must be accessed atomically. go.uber.org/atomic preserves all the functionality of the standard library, but wraps the primitive types to provide a safer, more convenient API.

var atom atomic.Uint32
atom.Store(42)
atom.Sub(2)
atom.CAS(40, 11)

See the documentation for a complete API specification.

Development Status

Stable.


Released under the [MIT License](LICENSE.txt).
Description
atomic [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] [![Go Report Card][reportcard-img]][reportcard]
Readme 235 KiB
Languages
Go 97.9%
Makefile 2.1%