diff options
author | Matt Joiner <anacrolix@gmail.com> | 2019-10-23 18:30:55 +1100 |
---|---|---|
committer | Matt Joiner <anacrolix@gmail.com> | 2019-10-23 18:30:55 +1100 |
commit | c0ede237be948532a9113d6db072a7847d02c890 (patch) | |
tree | 509ad139815eca014f7d734d4e3135a6e676e1b2 | |
parent | Register transaction condition with each read Var only (diff) | |
download | stm-c0ede237be948532a9113d6db072a7847d02c890.tar.gz stm-c0ede237be948532a9113d6db072a7847d02c890.tar.xz |
Get rid of globalCond
-rw-r--r-- | funcs.go | 5 | ||||
-rw-r--r-- | global.go | 1 | ||||
-rw-r--r-- | tx.go | 4 |
3 files changed, 3 insertions, 7 deletions
@@ -21,10 +21,7 @@ retry: goto retry } // commit the write log and broadcast that variables have changed - if len(tx.writes) > 0 { - tx.commit() - globalCond.Broadcast() - } + tx.commit() globalLock.Unlock() } @@ -5,4 +5,3 @@ import "sync" // The globalLock serializes transaction verification/committal. globalCond is // used to signal that at least one Var has changed. var globalLock sync.Mutex -var globalCond = sync.NewCond(&globalLock) @@ -39,7 +39,7 @@ func (tx *Tx) commit() { // wait blocks until another transaction modifies any of the Vars read by tx. func (tx *Tx) wait() { - globalCond.L.Lock() + globalLock.Lock() for v := range tx.reads { v.watchers[tx] = struct{}{} } @@ -49,7 +49,7 @@ func (tx *Tx) wait() { for v := range tx.reads { delete(v.watchers, tx) } - globalCond.L.Unlock() + globalLock.Unlock() } // Get returns the value of v as of the start of the transaction. |