mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 17:15:56 +00:00
avoid race on max count reads and writes
This commit is contained in:
parent
ba7db3028b
commit
d742c67317
2 changed files with 2 additions and 2 deletions
|
|
@ -36,8 +36,8 @@ var mu sync.RWMutex
|
|||
|
||||
// SetMaxMapCount sets the maximum map count, and returns the previous maximum.
|
||||
func SetMaxMapCount(max uint64) uint64 {
|
||||
prev := maxMapCount
|
||||
mu.Lock()
|
||||
prev := maxMapCount
|
||||
maxMapCount = max
|
||||
mu.Unlock()
|
||||
return prev
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ var maxFileCount uint64 = 500000
|
|||
var fileMu sync.RWMutex
|
||||
|
||||
func SetMaxFileCount(max uint64) uint64 {
|
||||
prev := maxFileCount
|
||||
fileMu.Lock()
|
||||
prev := maxFileCount
|
||||
maxFileCount = max
|
||||
fileMu.Unlock()
|
||||
return prev
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue