mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-28 14:47:16 +00:00
mdbx: proper atomic close (#827)
This commit is contained in:
parent
d2d03d140b
commit
493ae8b083
@ -431,10 +431,9 @@ func (db *MdbxKV) openDBIs(buckets []string) error {
|
||||
// Close closes db
|
||||
// All transactions must be closed before closing the database.
|
||||
func (db *MdbxKV) Close() {
|
||||
if db.closed.Load() {
|
||||
if db.closed.CompareAndSwap(false, true) {
|
||||
return
|
||||
}
|
||||
db.closed.Store(true)
|
||||
db.wg.Wait()
|
||||
db.env.Close()
|
||||
db.env = nil
|
||||
|
Loading…
Reference in New Issue
Block a user