mirror of https://github.com/siddontang/go.git
update atomic bool
This commit is contained in:
parent
cdaddb8a0e
commit
d00ecf67c6
|
@ -142,5 +142,5 @@ func (b *AtomicBool) Set(v bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *AtomicBool) Get() bool {
|
func (b *AtomicBool) Get() bool {
|
||||||
return atomic.LoadInt32((*int32)(i)) == 1
|
return atomic.LoadInt32((*int32)(b)) == 1
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,9 @@ func TestAtomicString(t *testing.T) {
|
||||||
if s.Get() != "c" {
|
if s.Get() != "c" {
|
||||||
t.Errorf("want c, got %s", s.Get())
|
t.Errorf("want c, got %s", s.Get())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestAtomicBool(t *testing.T) {
|
||||||
var b AtomicBool
|
var b AtomicBool
|
||||||
if b.Get() != false {
|
if b.Get() != false {
|
||||||
t.Fatal("must false")
|
t.Fatal("must false")
|
||||||
|
|
Loading…
Reference in New Issue