diff options
Diffstat (limited to 'src/pkg/container/ring/ring.go')
| -rw-r--r-- | src/pkg/container/ring/ring.go | 19 | 
1 files changed, 8 insertions, 11 deletions
| diff --git a/src/pkg/container/ring/ring.go b/src/pkg/container/ring/ring.go index 335afbc3c..5925164e9 100644 --- a/src/pkg/container/ring/ring.go +++ b/src/pkg/container/ring/ring.go @@ -138,16 +138,13 @@ func (r *Ring) Len() int {  } -func (r *Ring) Iter() <-chan interface{} { -	c := make(chan interface{}) -	go func() { -		if r != nil { -			c <- r.Value -			for p := r.Next(); p != r; p = p.next { -				c <- p.Value -			} +// Do calls function f on each element of the ring, in forward order. +// The behavior of Do is undefined if f changes *r. +func (r *Ring) Do(f func(interface{})) { +	if r != nil { +		f(r.Value) +		for p := r.Next(); p != r; p = p.next { +			f(p.Value)  		} -		close(c) -	}() -	return c +	}  } | 
