Skip to content

Commit 4a460e2

Browse files
committed
update methods docs
1 parent 9a2f3a1 commit 4a460e2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

dequeue.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type BlockingDequeue[T any] struct {
1616
isEmpty bool
1717
}
1818

19-
// Creates a new blocking dequeue with infinite capacity.
19+
// Creates a new blocking dequeue with the provided buffer.
2020
// The dequeue MUST only be created using this method.
2121
func NewBlockingDequeue[T any](buffer []T) *BlockingDequeue[T] {
2222
d := new(BlockingDequeue[T])
@@ -35,6 +35,7 @@ func NewBlockingDequeue[T any](buffer []T) *BlockingDequeue[T] {
3535
}
3636

3737
// =================================[Buffer helpers]=================================
38+
3839
func (d BlockingDequeue[T]) nextIndex(i int) int {
3940
return (i + 1) % len(d.buffer)
4041
}
@@ -153,7 +154,8 @@ func (d *BlockingDequeue[T]) PeekBack() T {
153154
return d.buffer[d.last]
154155
}
155156

156-
// ================================[Size/Capacity related]================================
157+
// ================================[Size related]================================
158+
157159
// Return the number of elements in the dequeue.
158160
func (d *BlockingDequeue[T]) Size() int {
159161
d.lock.Lock()
@@ -190,7 +192,6 @@ func (d *BlockingDequeue[T]) isFull_unsafe() bool {
190192
}
191193

192194
// Return true if the dequeue is full.
193-
// i.e. the dequeue has limited capacity and the current size is equal to that capacity.
194195
func (d *BlockingDequeue[T]) IsFull() bool {
195196
d.lock.Lock()
196197
defer d.lock.Unlock()

0 commit comments

Comments
 (0)