aboutsummaryrefslogtreecommitdiff
path: root/tx.go
diff options
context:
space:
mode:
authorMatt Joiner <anacrolix@gmail.com>2019-10-31 16:21:27 +1100
committerMatt Joiner <anacrolix@gmail.com>2019-10-31 16:21:27 +1100
commitd04075d6f23e92c33e30b244d2f4fc99428ee285 (patch)
tree31a2c212f4c549e43ae2e605baa4f8fbc489a4a5 /tx.go
parentPanic when trying to set a nil Var (diff)
downloadstm-d04075d6f23e92c33e30b244d2f4fc99428ee285.tar.gz
stm-d04075d6f23e92c33e30b244d2f4fc99428ee285.tar.xz
Add Tx.Return and a return value from Atomically
Diffstat (limited to 'tx.go')
-rw-r--r--tx.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/tx.go b/tx.go
index c2dcbdc..123c490 100644
--- a/tx.go
+++ b/tx.go
@@ -73,3 +73,11 @@ func (tx *Tx) Assert(p bool) {
tx.Retry()
}
}
+
+func (tx *Tx) Return(v interface{}) {
+ panic(_return{v})
+}
+
+type _return struct {
+ value interface{}
+}