m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-19 17:13:42 -05:00

Rewrite fzf in Go

This commit is contained in:
Junegunn Choi
2015-01-02 04:49:30 +09:00
parent 7ba93d9f83
commit f3177305d5
32 changed files with 3466 additions and 49 deletions

27
src/atomicbool.go Normal file
View File

@@ -0,0 +1,27 @@
package fzf
import "sync"
type AtomicBool struct {
mutex sync.Mutex
state bool
}
func NewAtomicBool(initialState bool) *AtomicBool {
return &AtomicBool{
mutex: sync.Mutex{},
state: initialState}
}
func (a *AtomicBool) Get() bool {
a.mutex.Lock()
defer a.mutex.Unlock()
return a.state
}
func (a *AtomicBool) Set(newState bool) bool {
a.mutex.Lock()
defer a.mutex.Unlock()
a.state = newState
return a.state
}