Files
webrtc/atomicbool.go
Pion c1467e4871 Update CI configs to v0.7.2
Update lint scripts and CI configs.
2022-04-27 23:00:19 -04:00

29 lines
410 B
Go

package webrtc
import "sync/atomic"
type atomicBool struct {
val int32
}
func (b *atomicBool) set(value bool) { // nolint: unparam
var i int32
if value {
i = 1
}
atomic.StoreInt32(&(b.val), i)
}
func (b *atomicBool) get() bool {
return atomic.LoadInt32(&(b.val)) != 0
}
func (b *atomicBool) swap(value bool) bool {
var i int32
if value {
i = 1
}
return atomic.SwapInt32(&(b.val), i) != 0
}