mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 18:00:08 +00:00
Heap is not thread safe in scheduling queue
This commit is contained in:
parent
8226973ae8
commit
3ef8ab4d70
@ -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{} {
|
|||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user