aboutsummaryrefslogtreecommitdiff
path: root/tx.go
diff options
context:
space:
mode:
authorMatt Joiner <anacrolix@gmail.com>2020-04-15 17:33:25 +1000
committerMatt Joiner <anacrolix@gmail.com>2020-04-15 17:33:25 +1000
commit8ddce5e3df43d4eb0ea3c53e831a6f2dab57ae28 (patch)
tree30386fdca20cfbe921508986c1f149f4a7510b0e /tx.go
parentRework ContextDoneVar to not leak done Contexts (diff)
downloadstm-8ddce5e3df43d4eb0ea3c53e831a6f2dab57ae28.tar.gz
stm-8ddce5e3df43d4eb0ea3c53e831a6f2dab57ae28.tar.xz
Panic when a transaction blocks after reading nothing
Diffstat (limited to 'tx.go')
-rw-r--r--tx.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/tx.go b/tx.go
index e90eb57..cdeac0b 100644
--- a/tx.go
+++ b/tx.go
@@ -36,6 +36,9 @@ func (tx *Tx) commit() {
// wait blocks until another transaction modifies any of the Vars read by tx.
func (tx *Tx) wait() {
+ if len(tx.reads) == 0 {
+ panic("not waiting on anything")
+ }
for v := range tx.reads {
v.watchers.Store(tx, nil)
}