Expor AtomicFlag type
This commit is contained in:
parent
9fd5c8af53
commit
8222f24fa7
@ -5,22 +5,22 @@ import (
|
||||
)
|
||||
|
||||
|
||||
type atomicflag struct {
|
||||
type AtomicFlag struct {
|
||||
value bool
|
||||
mutex sync.RWMutex
|
||||
}
|
||||
|
||||
func New(value bool) *atomicflag {
|
||||
return &atomicflag{value: value}
|
||||
func New(value bool) *AtomicFlag {
|
||||
return &AtomicFlag{value: value}
|
||||
}
|
||||
|
||||
func (f* atomicflag) Get() bool {
|
||||
func (f *AtomicFlag) Get() bool {
|
||||
f.mutex.RLock()
|
||||
defer f.mutex.RUnlock()
|
||||
return f.value
|
||||
}
|
||||
|
||||
func (f* atomicflag) Set(value bool) {
|
||||
func (f *AtomicFlag) Set(value bool) {
|
||||
f.mutex.Lock()
|
||||
defer f.mutex.Unlock()
|
||||
f.value = value
|
||||
|
Loading…
Reference in New Issue
Block a user