Merge pull request #56549 from CaoShuFeng/thread_safe

Automatic merge from submit-queue (batch tested with PRs 56579, 55236, 56512, 56549, 56538). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Heap is not thread safe in scheduling queue

/cc @bsalamat 

**Release note**:
```release-note
NONE
```
pull/6/head
Kubernetes Submit Queue 2017-12-15 21:19:42 -08:00 committed by GitHub
commit f5fa99cc82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -149,8 +149,6 @@ type UnschedulablePods interface {
// scheduling. This is called activeQ and is a Heap. Another queue holds
// pods that are already tried and are determined to be unschedulable. The latter
// is called unschedulableQ.
// Heap is already thread safe, but we need to acquire another lock here to ensure
// atomicity of operations on the two data structures..
type PriorityQueue struct {
lock sync.RWMutex
cond sync.Cond
@ -611,7 +609,7 @@ func (h *heapData) Pop() interface{} {
return item.obj
}
// Heap is a thread-safe producer/consumer queue that implements a heap data structure.
// Heap is a producer/consumer queue that implements a heap data structure.
// It can be used to implement priority queues and similar data structures.
type Heap struct {
// data stores objects and has a queue that keeps their ordering according