Skip to content
This repository has been archived by the owner on Mar 9, 2019. It is now read-only.

Commit

Permalink
Merge pull request #550 from ChrisHines/windows-remove-lock
Browse files Browse the repository at this point in the history
Delay clearing db.path until just before db.close returns.
  • Loading branch information
benbjohnson committed Apr 7, 2016
2 parents 831b652 + 5816124 commit 144418e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ type DB struct {
path string
file *os.File
lockfile *os.File // windows only
dataref []byte // mmap'ed readonly, write throws SEGV
dataref []byte // mmap'ed readonly, write throws SEGV
data *[maxMapSize]byte
datasz int
filesz int // current on disk file size
Expand Down Expand Up @@ -383,11 +383,10 @@ func (db *DB) close() error {
if !db.opened {
return nil
}

db.opened = false

db.freelist = nil
db.path = ""

// Clear ops.
db.ops.writeAt = nil
Expand All @@ -414,6 +413,7 @@ func (db *DB) close() error {
db.file = nil
}

db.path = ""
return nil
}

Expand Down

0 comments on commit 144418e

Please sign in to comment.