mirror of https://github.com/tevino/abool.git
Add example code
This commit is contained in:
parent
eedf32b55b
commit
ba4fdb7068
|
@ -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
|
// Benchmark Read
|
||||||
|
|
||||||
func BenchmarkMutexRead(b *testing.B) {
|
func BenchmarkMutexRead(b *testing.B) {
|
||||||
|
|
Loading…
Reference in New Issue