update atomic bool

This commit is contained in:
siddontang 2014-11-21 10:05:03 +08:00
parent cdaddb8a0e
commit d00ecf67c6
2 changed files with 3 additions and 1 deletions

View File

@ -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
} }

View File

@ -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")