Unverified Commit f5fa99cc authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

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 ```
parents 12402f3a 3ef8ab4d
...@@ -149,8 +149,6 @@ type UnschedulablePods interface { ...@@ -149,8 +149,6 @@ type UnschedulablePods interface {
// scheduling. This is called activeQ and is a Heap. Another queue holds // 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 // pods that are already tried and are determined to be unschedulable. The latter
// is called unschedulableQ. // 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 { type PriorityQueue struct {
lock sync.RWMutex lock sync.RWMutex
cond sync.Cond cond sync.Cond
...@@ -611,7 +609,7 @@ func (h *heapData) Pop() interface{} { ...@@ -611,7 +609,7 @@ func (h *heapData) Pop() interface{} {
return item.obj 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. // It can be used to implement priority queues and similar data structures.
type Heap struct { type Heap struct {
// data stores objects and has a queue that keeps their ordering according // data stores objects and has a queue that keeps their ordering according
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment