diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2024-07-06 18:09:04 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2024-07-06 18:09:04 +0800 |
| commit | 18666e3475d3a4180d9becc03cb105fcaa6c6801 (patch) | |
| tree | e80c0968dc91258afdbe5337c1478efd2f43a006 /dot-oh-my-zsh/custom/plugins/fzf/src/util/atomicbool.go | |
| parent | bb533a817ed9449942905e0c5c8164f4474fbf0c (diff) | |
added submodule
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 -} |
