From 7a2bc2cada971c7a390d09b0afda34780ff56fb6 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Mon, 12 Jan 2015 03:01:24 +0900 Subject: Lint --- src/atomicbool.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/atomicbool.go') diff --git a/src/atomicbool.go b/src/atomicbool.go index f2f4894f..b264724c 100644 --- a/src/atomicbool.go +++ b/src/atomicbool.go @@ -2,23 +2,28 @@ package fzf import "sync" +// AtomicBool is a boxed-class that provides synchronized access to the +// underlying boolean value type AtomicBool struct { mutex sync.Mutex state bool } +// NewAtomicBool returns a new AtomicBool func NewAtomicBool(initialState bool) *AtomicBool { return &AtomicBool{ mutex: sync.Mutex{}, state: initialState} } +// Get returns the current boolean value synchronously func (a *AtomicBool) Get() bool { a.mutex.Lock() defer a.mutex.Unlock() return a.state } +// Set updates the boolean value synchronously func (a *AtomicBool) Set(newState bool) bool { a.mutex.Lock() defer a.mutex.Unlock() -- cgit v1.2.3