From 6662858d9357f2684573721476a9bb7d9cddeaae Mon Sep 17 00:00:00 2001 From: Tevin Zhang Date: Thu, 2 Jun 2016 11:48:02 +0800 Subject: [PATCH] Refine comments --- bool.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bool.go b/bool.go index cbd9347..fdda210 100644 --- a/bool.go +++ b/bool.go @@ -18,27 +18,29 @@ func NewBool(ok bool) *AtomicBool { return ab } -// AtomicBool is a atomic boolean +// AtomicBool is an atomic Boolean +// Its methods are all atomic, thus safe to be called by +// multiple goroutines simultaneously // Note: When embedding into a struct, one should always use // *AtomicBool to avoid copy type AtomicBool int32 -// Set sets the bool to true +// Set sets the Boolean to true func (ab *AtomicBool) Set() { atomic.StoreInt32((*int32)(ab), 1) } -// UnSet sets the bool to false +// UnSet sets the Boolean to false func (ab *AtomicBool) UnSet() { atomic.StoreInt32((*int32)(ab), 0) } -// IsSet returns whether the bool is true +// IsSet returns whether the Boolean is true func (ab *AtomicBool) IsSet() bool { return atomic.LoadInt32((*int32)(ab)) == 1 } -// SetTo sets the boolean with given bool +// SetTo sets the boolean with given Boolean func (ab *AtomicBool) SetTo(yes bool) { if yes { atomic.StoreInt32((*int32)(ab), 1)