github.com/okex/exchain@v1.8.0/libs/tendermint/global/commit_mutex.go (about) 1 package global 2 3 import ( 4 "sync" 5 ) 6 7 var ( 8 signalMtx sync.RWMutex 9 commitSignal = make(chan struct{}) 10 ) 11 12 func init() { 13 close(commitSignal) 14 } 15 16 func CommitLock() { 17 signalMtx.Lock() 18 commitSignal = make(chan struct{}) 19 signalMtx.Unlock() 20 } 21 22 func CommitUnlock() { 23 close(commitSignal) 24 } 25 26 func WaitCommit() { 27 signalMtx.RLock() 28 <-commitSignal 29 signalMtx.RUnlock() 30 }