Add example code

This commit is contained in:
Tevin Zhang 2016-05-25 14:16:55 +08:00
parent eedf32b55b
commit ba4fdb7068
1 changed files with 8 additions and 0 deletions

View File

@ -33,6 +33,14 @@ func TestBool(t *testing.T) {
}
}
func ExampleAtomicBool() {
cond := New() // default to false
cond.Set() // set to true
cond.IsSet() // returns true
cond.UnSet() // set to false
cond.SetTo(true) // set to whatever you want
}
// Benchmark Read
func BenchmarkMutexRead(b *testing.B) {