mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
wait: Waiter -> WaitList
This commit is contained in:
parent
f9c4ba3ea3
commit
e2d8e1868b
10
wait/wait.go
10
wait/wait.go
@ -2,16 +2,16 @@ package wait
|
||||
|
||||
import "sync"
|
||||
|
||||
type Waiter struct {
|
||||
type WaitList struct {
|
||||
l sync.Mutex
|
||||
m map[int64]chan interface{}
|
||||
}
|
||||
|
||||
func New() Waiter {
|
||||
return Waiter{m: make(map[int64]chan interface{})}
|
||||
func New() WaitList {
|
||||
return WaitList{m: make(map[int64]chan interface{})}
|
||||
}
|
||||
|
||||
func (w Waiter) Register(id int64) <-chan interface{} {
|
||||
func (w WaitList) Register(id int64) <-chan interface{} {
|
||||
w.l.Lock()
|
||||
defer w.l.Unlock()
|
||||
ch := w.m[id]
|
||||
@ -22,7 +22,7 @@ func (w Waiter) Register(id int64) <-chan interface{} {
|
||||
return ch
|
||||
}
|
||||
|
||||
func (w Waiter) Trigger(id int64, x interface{}) {
|
||||
func (w WaitList) Trigger(id int64, x interface{}) {
|
||||
w.l.Lock()
|
||||
ch := w.m[id]
|
||||
delete(w.m, id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user