mirror of
https://github.com/navidrome/navidrome.git
synced 2024-09-11 20:12:54 +02:00
18 lines
267 B
Go
18 lines
267 B
Go
package utils
|
|
|
|
import "sync/atomic"
|
|
|
|
type AtomicBool struct{ flag int32 }
|
|
|
|
func (b *AtomicBool) Get() bool {
|
|
return atomic.LoadInt32(&(b.flag)) != 0
|
|
}
|
|
|
|
func (b *AtomicBool) Set(value bool) {
|
|
var i int32 = 0
|
|
if value {
|
|
i = 1
|
|
}
|
|
atomic.StoreInt32(&(b.flag), i)
|
|
}
|