From 8ddce5e3df43d4eb0ea3c53e831a6f2dab57ae28 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Wed, 15 Apr 2020 17:33:25 +1000 Subject: Panic when a transaction blocks after reading nothing --- tx.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tx.go') 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) } -- cgit v1.2.3