summaryrefslogtreecommitdiffhomepage
path: root/src/misc.go
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2017-11-17 17:25:45 +0100
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2017-11-17 17:25:58 +0100
commitfa399a91d5da9874cbf248e00db8dbd87b587e91 (patch)
tree8aaca42f4a3cc11666c12d5077e8ed5ac35200a8 /src/misc.go
parente1227d3af480eae72639cde842b4d538c58936dc (diff)
Ported remaining netns.sh
- Ported remaining netns.sh tests - Begin work on generic implementation of bind interface
Diffstat (limited to 'src/misc.go')
-rw-r--r--src/misc.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/misc.go b/src/misc.go
index bbe0d68..b43e97e 100644
--- a/src/misc.go
+++ b/src/misc.go
@@ -21,6 +21,14 @@ func (a *AtomicBool) Get() bool {
return atomic.LoadInt32(&a.flag) == AtomicTrue
}
+func (a *AtomicBool) Swap(val bool) bool {
+ flag := AtomicFalse
+ if val {
+ flag = AtomicTrue
+ }
+ return atomic.SwapInt32(&a.flag, flag) == AtomicTrue
+}
+
func (a *AtomicBool) Set(val bool) {
flag := AtomicFalse
if val {