diff options
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/gvsync/atomicptr_unsafe.go | 12 | ||||
-rw-r--r-- | third_party/gvsync/atomicptrtest/BUILD | 4 | ||||
-rw-r--r-- | third_party/gvsync/seqatomictest/BUILD | 4 |
3 files changed, 15 insertions, 5 deletions
diff --git a/third_party/gvsync/atomicptr_unsafe.go b/third_party/gvsync/atomicptr_unsafe.go index 53a943282..525c4beed 100644 --- a/third_party/gvsync/atomicptr_unsafe.go +++ b/third_party/gvsync/atomicptr_unsafe.go @@ -21,8 +21,18 @@ type Value struct{} // Note that copying AtomicPtr by value performs a non-atomic read of the // stored pointer, which is unsafe if Store() can be called concurrently; in // this case, do `dst.Store(src.Load())` instead. +// +// +stateify savable type AtomicPtr struct { - ptr unsafe.Pointer + ptr unsafe.Pointer `state:".(*Value)"` +} + +func (p *AtomicPtr) savePtr() *Value { + return p.Load() +} + +func (p *AtomicPtr) loadPtr(v *Value) { + p.Store(v) } // Load returns the value set by the most recent Store. It returns nil if there diff --git a/third_party/gvsync/atomicptrtest/BUILD b/third_party/gvsync/atomicptrtest/BUILD index 631b0b64c..6cf69ea91 100644 --- a/third_party/gvsync/atomicptrtest/BUILD +++ b/third_party/gvsync/atomicptrtest/BUILD @@ -6,7 +6,7 @@ load("//tools/go_generics:defs.bzl", "go_template_instance") go_template_instance( name = "atomicptr_int", - out = "atomicptr_int.go", + out = "atomicptr_int_unsafe.go", package = "atomicptr", suffix = "Int", template = "//third_party/gvsync:generic_atomicptr", @@ -17,7 +17,7 @@ go_template_instance( go_library( name = "atomicptr", - srcs = ["atomicptr_int.go"], + srcs = ["atomicptr_int_unsafe.go"], importpath = "gvisor.dev/gvisor/third_party/gvsync/atomicptr", ) diff --git a/third_party/gvsync/seqatomictest/BUILD b/third_party/gvsync/seqatomictest/BUILD index 9dd600148..9e87e0bc5 100644 --- a/third_party/gvsync/seqatomictest/BUILD +++ b/third_party/gvsync/seqatomictest/BUILD @@ -6,7 +6,7 @@ load("//tools/go_generics:defs.bzl", "go_template_instance") go_template_instance( name = "seqatomic_int", - out = "seqatomic_int.go", + out = "seqatomic_int_unsafe.go", package = "seqatomic", suffix = "Int", template = "//third_party/gvsync:generic_seqatomic", @@ -17,7 +17,7 @@ go_template_instance( go_library( name = "seqatomic", - srcs = ["seqatomic_int.go"], + srcs = ["seqatomic_int_unsafe.go"], importpath = "gvisor.dev/gvisor/third_party/gvsync/seqatomic", deps = [ "//third_party/gvsync", |