From 3ef8ab4d70658aa2c506323defd61dc98f5496dc Mon Sep 17 00:00:00 2001 From: Cao Shufeng Date: Wed, 29 Nov 2017 13:46:24 +0800 Subject: [PATCH] Heap is not thread safe in scheduling queue --- plugin/pkg/scheduler/core/scheduling_queue.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugin/pkg/scheduler/core/scheduling_queue.go b/plugin/pkg/scheduler/core/scheduling_queue.go index 78bdf099015..f258fd1ee76 100644 --- a/plugin/pkg/scheduler/core/scheduling_queue.go +++ b/plugin/pkg/scheduler/core/scheduling_queue.go @@ -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