mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 09:23:48 +00:00
ethdb: remove memory batch lock
Batches are not safe for concurrent use.
This commit is contained in:
parent
8321a45f46
commit
97beadd4fc
1 changed files with 0 additions and 7 deletions
|
|
@ -101,21 +101,14 @@ type kv struct{ k, v []byte }
|
|||
type memBatch struct {
|
||||
db *MemDatabase
|
||||
writes []kv
|
||||
lock sync.RWMutex
|
||||
}
|
||||
|
||||
func (b *memBatch) Put(key, value []byte) error {
|
||||
b.lock.Lock()
|
||||
defer b.lock.Unlock()
|
||||
|
||||
b.writes = append(b.writes, kv{common.CopyBytes(key), common.CopyBytes(value)})
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *memBatch) Write() error {
|
||||
b.lock.RLock()
|
||||
defer b.lock.RUnlock()
|
||||
|
||||
b.db.lock.Lock()
|
||||
defer b.db.lock.Unlock()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue