diff options
Diffstat (limited to 'dot-oh-my-zsh/custom/plugins/fzf/src/util/atomicbool.go')
| m--------- | dot-oh-my-zsh | 0 | ||||
| -rw-r--r-- | dot-oh-my-zsh/custom/plugins/fzf/src/util/atomicbool.go | 34 |
2 files changed, 0 insertions, 34 deletions
diff --git a/dot-oh-my-zsh b/dot-oh-my-zsh new file mode 160000 +Subproject 6fe84bf5c82da7b1f6d7c5ec3e5c447721ac8ce diff --git a/dot-oh-my-zsh/custom/plugins/fzf/src/util/atomicbool.go b/dot-oh-my-zsh/custom/plugins/fzf/src/util/atomicbool.go deleted file mode 100644 index c5c7e690..00000000 --- a/dot-oh-my-zsh/custom/plugins/fzf/src/util/atomicbool.go +++ /dev/null @@ -1,34 +0,0 @@ -package util - -import ( - "sync/atomic" -) - -func convertBoolToInt32(b bool) int32 { - if b { - return 1 - } - return 0 -} - -// AtomicBool is a boxed-class that provides synchronized access to the -// underlying boolean value -type AtomicBool struct { - state int32 // "1" is true, "0" is false -} - -// NewAtomicBool returns a new AtomicBool -func NewAtomicBool(initialState bool) *AtomicBool { - return &AtomicBool{state: convertBoolToInt32(initialState)} -} - -// Get returns the current boolean value synchronously -func (a *AtomicBool) Get() bool { - return atomic.LoadInt32(&a.state) == 1 -} - -// Set updates the boolean value synchronously -func (a *AtomicBool) Set(newState bool) bool { - atomic.StoreInt32(&a.state, convertBoolToInt32(newState)) - return newState -} |
