Files
quic-go/utils/atomic_bool.go
Marten Seemann 4e0ef58bab allow stream.Read for streams that a RST was received for
and a lot of code improvements

fixes #385
2017-01-09 09:49:43 +07:00

23 lines
331 B
Go

package utils
import "sync/atomic"
// An AtomicBool is an atomic bool
type AtomicBool struct {
v int32
}
// Set sets the value
func (a *AtomicBool) Set(value bool) {
var n int32
if value {
n = 1
}
atomic.StoreInt32(&a.v, n)
}
// Get gets the value
func (a *AtomicBool) Get() bool {
return atomic.LoadInt32(&a.v) != 0
}