modificati i nomi delle funzioni del Counter
This commit is contained in:
parent
16930ed9c1
commit
4c160678b3
3 changed files with 25 additions and 25 deletions
40
counter.go
40
counter.go
|
@ -28,84 +28,84 @@ func NewCounter() *Counter {
|
|||
|
||||
func (c *Counter) AddUser() {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
c.user++
|
||||
c.mu.Unlock()
|
||||
}
|
||||
|
||||
func (c *Counter) AddDuplicate() {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
c.dup++
|
||||
c.mu.Unlock()
|
||||
}
|
||||
|
||||
func (c *Counter) AddLog(add int) {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
c.log += add
|
||||
c.mu.Unlock()
|
||||
}
|
||||
|
||||
func (c *Counter) AddRem(add int) {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
c.rem += add
|
||||
c.mu.Unlock()
|
||||
}
|
||||
|
||||
func (c *Counter) AddWG(id int) {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
c.wg[id]++
|
||||
c.mu.Unlock()
|
||||
}
|
||||
|
||||
func (c *Counter) AddErr() {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
c.err++
|
||||
c.mu.Unlock()
|
||||
}
|
||||
|
||||
func (c *Counter) RemWG(id int) {
|
||||
func (c *Counter) DelWG(id int) {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
c.wg[id]--
|
||||
c.mu.Unlock()
|
||||
}
|
||||
|
||||
func (c *Counter) ValUser() (ret int) {
|
||||
func (c *Counter) GetUser() (ret int) {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
ret = c.user
|
||||
c.mu.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Counter) ValDup() (ret int) {
|
||||
func (c *Counter) GetDup() (ret int) {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
ret = c.dup
|
||||
c.mu.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Counter) ValLog() (ret int) {
|
||||
func (c *Counter) GetLog() (ret int) {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
ret = c.log
|
||||
c.mu.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Counter) ValErr() (ret int) {
|
||||
func (c *Counter) GetErr() (ret int) {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
ret = c.err
|
||||
c.mu.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Counter) ValRem() (ret int) {
|
||||
func (c *Counter) GetRem() (ret int) {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
ret = c.rem
|
||||
c.mu.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Counter) ValWG(id int) (ret int) {
|
||||
func (c *Counter) GetWG(id int) (ret int) {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
ret = c.wg[id]
|
||||
c.mu.Unlock()
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue