aboutsummaryrefslogtreecommitdiff
path: root/var.go
diff options
context:
space:
mode:
authorMatt Joiner <anacrolix@gmail.com>2019-10-23 15:38:09 +1100
committerMatt Joiner <anacrolix@gmail.com>2019-10-23 15:38:09 +1100
commit7655ef3f131d1dfd33e1d0252df1aaaf04e31dc0 (patch)
treef626289c01711474d20b7f11dffcbdb8072f8b7a /var.go
parentPut benchmarks in their own file (diff)
downloadstm-7655ef3f131d1dfd33e1d0252df1aaaf04e31dc0.tar.gz
stm-7655ef3f131d1dfd33e1d0252df1aaaf04e31dc0.tar.xz
Break up the stm.go file
Diffstat (limited to 'var.go')
-rw-r--r--var.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/var.go b/var.go
new file mode 100644
index 0000000..3494352
--- /dev/null
+++ b/var.go
@@ -0,0 +1,15 @@
+package stm
+
+import "sync"
+
+// A Var holds an STM variable.
+type Var struct {
+ val interface{}
+ version uint64
+ mu sync.Mutex
+}
+
+// NewVar returns a new STM variable.
+func NewVar(val interface{}) *Var {
+ return &Var{val: val}
+}