types: avoid using defer unlock in CopyDepth

This commit is contained in:
c9s 2024-01-24 17:48:13 +08:00
parent 6cf5300650
commit 805fea32df
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -101,25 +101,25 @@ func (b *MutexOrderBook) Reset() {
b.Unlock()
}
func (b *MutexOrderBook) CopyDepth(depth int) OrderBook {
func (b *MutexOrderBook) CopyDepth(depth int) (ob OrderBook) {
b.Lock()
defer b.Unlock()
return b.orderBook.CopyDepth(depth)
ob = b.orderBook.CopyDepth(depth)
b.Unlock()
return ob
}
func (b *MutexOrderBook) Copy() OrderBook {
func (b *MutexOrderBook) Copy() (ob OrderBook) {
b.Lock()
defer b.Unlock()
ob = b.orderBook.Copy()
b.Unlock()
return b.orderBook.Copy()
return ob
}
func (b *MutexOrderBook) Update(update SliceOrderBook) {
b.Lock()
defer b.Unlock()
b.orderBook.Update(update)
b.Unlock()
}
type BookSignalType string