Removed unused atomics

This commit is contained in:
tidwall 2018-11-23 01:39:04 -07:00
parent 58421ef806
commit 37531f9350
4 changed files with 3 additions and 42 deletions

View File

@ -169,6 +169,7 @@ func (server *Server) writeAOF(args []string, d *commandDetailsT) error {
} }
} }
} }
// live geofences // live geofences
server.lcond.L.Lock() server.lcond.L.Lock()
if d.parent { if d.parent {

View File

@ -1,9 +1,7 @@
package server package server
import ( import (
"sync"
"sync/atomic" "sync/atomic"
"time"
) )
type aint struct{ v uintptr } type aint struct{ v uintptr }
@ -32,41 +30,3 @@ func (a *abool) set(t bool) bool {
} }
return atomic.SwapUint32(&a.v, 0) != 0 return atomic.SwapUint32(&a.v, 0) != 0
} }
type astring struct {
mu sync.Mutex
v string
}
func (a *astring) get() string {
a.mu.Lock()
p := a.v
a.mu.Unlock()
return p
}
func (a *astring) set(s string) string {
a.mu.Lock()
p := a.v
a.v = s
a.mu.Unlock()
return p
}
type atime struct {
mu sync.Mutex
v time.Time
}
func (a *atime) get() time.Time {
a.mu.Lock()
p := a.v
a.mu.Unlock()
return p
}
func (a *atime) set(t time.Time) time.Time {
a.mu.Lock()
p := a.v
a.v = t
a.mu.Unlock()
return p
}

View File

@ -80,7 +80,6 @@ type Server struct {
statsTotalCommands aint // counter for total commands statsTotalCommands aint // counter for total commands
statsExpired aint // item expiration counter statsExpired aint // item expiration counter
lastShrinkDuration aint lastShrinkDuration aint
currentShrinkStart atime
stopBackgroundExpiring abool stopBackgroundExpiring abool
stopWatchingMemory abool stopWatchingMemory abool
stopWatchingAutoGC abool stopWatchingAutoGC abool

View File

@ -160,7 +160,8 @@ func (c *Server) writeInfoPersistence(w *bytes.Buffer) {
fmt.Fprintf(w, "aof_enabled:1\r\n") fmt.Fprintf(w, "aof_enabled:1\r\n")
fmt.Fprintf(w, "aof_rewrite_in_progress:%d\r\n", boolInt(c.shrinking)) // Flag indicating a AOF rewrite operation is on-going fmt.Fprintf(w, "aof_rewrite_in_progress:%d\r\n", boolInt(c.shrinking)) // Flag indicating a AOF rewrite operation is on-going
fmt.Fprintf(w, "aof_last_rewrite_time_sec:%d\r\n", c.lastShrinkDuration.get()/int(time.Second)) // Duration of the last AOF rewrite operation in seconds fmt.Fprintf(w, "aof_last_rewrite_time_sec:%d\r\n", c.lastShrinkDuration.get()/int(time.Second)) // Duration of the last AOF rewrite operation in seconds
currentShrinkStart := c.currentShrinkStart.get()
var currentShrinkStart time.Time // c.currentShrinkStart.get()
if currentShrinkStart.IsZero() { if currentShrinkStart.IsZero() {
fmt.Fprintf(w, "aof_current_rewrite_time_sec:0\r\n") // Duration of the on-going AOF rewrite operation if any fmt.Fprintf(w, "aof_current_rewrite_time_sec:0\r\n") // Duration of the on-going AOF rewrite operation if any
} else { } else {