We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4476701 commit 295d223Copy full SHA for 295d223
1 file changed
queue/linked_blocking_queue.go
@@ -391,7 +391,17 @@ func (q *LinkedBlockingQueue) Clear() {
391
// defer q.fullyUnlock()
392
}
393
394
+/**
395
+ * @Description: create a LinkedBlockingQueue with the given capacity.
396
+ if capacity is 0, it'll be replace by math.MaxInt32,
397
+ if capacity is less than 0, IllegalArgumentError will be panic
398
+ * @param capacity
399
+ * @return *LinkedBlockingQueue
400
+*/
401
func NewLinkedBlockingQueue(capacity int) *LinkedBlockingQueue {
402
+ if capacity < 0 {
403
+ panic(IllegalArgumentError)
404
+ }
405
if capacity == 0 {
406
capacity = math.MaxInt32
407
0 commit comments