blob: a7ca52a72f4f93dbc200a44b44c99b3252732a47 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
using System;
namespace QtVsTools
{
public class PunisherQueue<T> : BasePriorityQueue<T, long>
{
public PunisherQueue()
{ }
public PunisherQueue(Func<T, object> getItemKey) : base(getItemKey)
{ }
/// <summary>
/// Enqueue/re-queue moves item to back of the queue, effectively "punishing" items that
/// were already in the queue.
/// </summary>
///
public void Enqueue(T item)
{
lock (CriticalSection) {
Enqueue(item, Timestamp.Next());
}
}
}
}
|