From ba4fdb706890b17a13c81085756da0679ce6d0c2 Mon Sep 17 00:00:00 2001 From: Tevin Zhang Date: Wed, 25 May 2016 14:16:55 +0800 Subject: [PATCH] Add example code --- bool_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bool_test.go b/bool_test.go index 89c3209..62d7463 100644 --- a/bool_test.go +++ b/bool_test.go @@ -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) {