Skip to content

Commit f1630e2

Browse files
committed
doc
1 parent 2f071a8 commit f1630e2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

list.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var (
1010
ErrStopped = errors.New("stopped")
1111
)
1212

13-
// List is a non-blocking unbounded lock-free channel-based list for Golang.
13+
// List is a non-blocking unbounded lock-free channel-based list.
1414
type List[E any, Q ListType[E]] struct {
1515
out <-chan E
1616
in atomic.Pointer[chan<- E]
@@ -64,6 +64,8 @@ func (q *List[E, Q]) PutCheck(e E) error {
6464
return ErrStopped
6565
}
6666

67+
// Size returns the number of items in the list.
68+
// If the list is closed, returns -1.
6769
func (q *List[E, Q]) Size() int {
6870
select {
6971
case info, ok := <-q.info:
@@ -74,6 +76,7 @@ func (q *List[E, Q]) Size() int {
7476
}
7577
}
7678

79+
// Stopped returns whether Stop was called.
7780
func (q *List[E, Q]) Stopped() bool {
7881
return q.in.Load() == nil
7982
}

0 commit comments

Comments
 (0)