diff options
author | Matt Joiner <anacrolix@gmail.com> | 2020-04-15 17:33:25 +1000 |
---|---|---|
committer | Matt Joiner <anacrolix@gmail.com> | 2020-04-15 17:33:25 +1000 |
commit | 8ddce5e3df43d4eb0ea3c53e831a6f2dab57ae28 (patch) | |
tree | 30386fdca20cfbe921508986c1f149f4a7510b0e /tx.go | |
parent | Rework ContextDoneVar to not leak done Contexts (diff) | |
download | stm-8ddce5e3df43d4eb0ea3c53e831a6f2dab57ae28.tar.gz stm-8ddce5e3df43d4eb0ea3c53e831a6f2dab57ae28.tar.xz |
Panic when a transaction blocks after reading nothing
Diffstat (limited to 'tx.go')
-rw-r--r-- | tx.go | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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) } |