Skip to content

Commit 3df7857

Browse files
committed
add DeepCopy function
1 parent 295d223 commit 3df7857

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

queue/linked_blocking_queue.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,11 @@ func FromSlice(s []interface{}, capacity int) (*LinkedBlockingQueue, error) {
443443
return q, nil
444444
}
445445

446+
func DeepCopy(q *LinkedBlockingQueue) *LinkedBlockingQueue {
447+
copied, _ := FromSlice(q.ToSlice(), q.capacity)
448+
return copied
449+
}
450+
446451
/**
447452
* Signals a waiting take. Called only from put/offer (which do not
448453
* otherwise ordinarily lock takeLock.)

0 commit comments

Comments
 (0)