diff options
Diffstat (limited to 'vendor/github.com/pion/webrtc/v3/atomicbool.go')
-rw-r--r-- | vendor/github.com/pion/webrtc/v3/atomicbool.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/vendor/github.com/pion/webrtc/v3/atomicbool.go b/vendor/github.com/pion/webrtc/v3/atomicbool.go new file mode 100644 index 0000000..c5ace62 --- /dev/null +++ b/vendor/github.com/pion/webrtc/v3/atomicbool.go @@ -0,0 +1,20 @@ +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 +} |