aboutsummaryrefslogtreecommitdiff
path: root/modules/sync
diff options
context:
space:
mode:
Diffstat (limited to 'modules/sync')
-rw-r--r--modules/sync/status_pool.go14
-rw-r--r--modules/sync/unique_queue.go4
2 files changed, 9 insertions, 9 deletions
diff --git a/modules/sync/status_pool.go b/modules/sync/status_pool.go
index f6a7f949..2d729715 100644
--- a/modules/sync/status_pool.go
+++ b/modules/sync/status_pool.go
@@ -13,7 +13,7 @@ import (
// This table is particularly useful for un/marking and checking values
// in different goroutines.
type StatusTable struct {
- lock sync.RWMutex
+ sync.RWMutex
pool map[string]bool
}
@@ -26,24 +26,24 @@ func NewStatusTable() *StatusTable {
// Start sets value of given name to true in the pool.
func (p *StatusTable) Start(name string) {
- p.lock.Lock()
- defer p.lock.Unlock()
+ p.Lock()
+ defer p.Unlock()
p.pool[name] = true
}
// Stop sets value of given name to false in the pool.
func (p *StatusTable) Stop(name string) {
- p.lock.Lock()
- defer p.lock.Unlock()
+ p.Lock()
+ defer p.Unlock()
p.pool[name] = false
}
// IsRunning checks if value of given name is set to true in the pool.
func (p *StatusTable) IsRunning(name string) bool {
- p.lock.RLock()
- defer p.lock.RUnlock()
+ p.RLock()
+ defer p.RUnlock()
return p.pool[name]
}
diff --git a/modules/sync/unique_queue.go b/modules/sync/unique_queue.go
index 3f3c1c86..61b0aa5b 100644
--- a/modules/sync/unique_queue.go
+++ b/modules/sync/unique_queue.go
@@ -50,12 +50,12 @@ func (q *UniqueQueue) AddFunc(id interface{}, fn func()) {
}
idStr := com.ToStr(id)
- q.table.lock.Lock()
+ q.table.Lock()
q.table.pool[idStr] = true
if fn != nil {
fn()
}
- q.table.lock.Unlock()
+ q.table.Unlock()
q.queue <- idStr
}