File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ type BlockingDequeue[T any] struct {
16
16
isEmpty bool
17
17
}
18
18
19
- // Creates a new blocking dequeue with infinite capacity .
19
+ // Creates a new blocking dequeue with the provided buffer .
20
20
// The dequeue MUST only be created using this method.
21
21
func NewBlockingDequeue [T any ](buffer []T ) * BlockingDequeue [T ] {
22
22
d := new (BlockingDequeue [T ])
@@ -35,6 +35,7 @@ func NewBlockingDequeue[T any](buffer []T) *BlockingDequeue[T] {
35
35
}
36
36
37
37
// =================================[Buffer helpers]=================================
38
+
38
39
func (d BlockingDequeue [T ]) nextIndex (i int ) int {
39
40
return (i + 1 ) % len (d .buffer )
40
41
}
@@ -153,7 +154,8 @@ func (d *BlockingDequeue[T]) PeekBack() T {
153
154
return d .buffer [d .last ]
154
155
}
155
156
156
- // ================================[Size/Capacity related]================================
157
+ // ================================[Size related]================================
158
+
157
159
// Return the number of elements in the dequeue.
158
160
func (d * BlockingDequeue [T ]) Size () int {
159
161
d .lock .Lock ()
@@ -190,7 +192,6 @@ func (d *BlockingDequeue[T]) isFull_unsafe() bool {
190
192
}
191
193
192
194
// Return true if the dequeue is full.
193
- // i.e. the dequeue has limited capacity and the current size is equal to that capacity.
194
195
func (d * BlockingDequeue [T ]) IsFull () bool {
195
196
d .lock .Lock ()
196
197
defer d .lock .Unlock ()
You can’t perform that action at this time.
0 commit comments