DOKK / manpages / debian 12 / tirex / Tirex::PrioQueue.3pm.en
Tirex::PrioQueue(3pm) User Contributed Perl Documentation Tirex::PrioQueue(3pm)

Tirex::PrioQueue - Queue for one priority

 use Tirex::PrioQueue;
 my $pq = Tirex::PrioQueue->new(prio => 7);
 $pq->add($job);
 $pq->remove($job);
 $job = $pq->next();

PrioQueues hold all jobs with a certain priority. They are never accessed directly, only through a Tirex::Queue object.

Create new priority queue object.

Returns the size of the priority queue.

Is the priority queue empty?

Returns true if the queue is empty, false otherwise.

Reset the queue. All jobs on the queue will be lost!

Returns priority queue itself, so that calls can be chained.

Add job to priority queue. The job will only be added if the job priority and the queue priority are the same. This method will *not* check whether a job for the same metatile is already in the queue.

Returns the job if it was added, undef otherwise.

Remove a job from the priority queue.

Returns the job or undef if the job was not on this queue.

The priority queue can have empty (undef) items in it where there was a real job that was removed when another job for the same metatile came in. This method will clean those empty items from the beginning and end of the queue. It is called from remove() and next() methods to ensure that there are no empty items at the beginning or end at any time.

Returns priority queue itself, so that calls can be chained.

Get first element of the priority queue without removing it.

Returns false if the queue is empty.

Remove and return first element of the priority queue.

Returns false if there are no jobs in the queue.

Returns age (in seconds) of first job in the priority queue. Age is the difference between current and request time.

Returns false if the priority queue is empty.

Returns age (in seconds) of last job in the priority queue. Age is the difference between current and request time.

Returns false if the priority queue is empty.

Reset maxsize. New maxsize will be equal to current size.

Returns new maxsize;

Remove all jobs from this prioqueue where the map is undefined. This can happen after a reload of the config file, when a map was deleted from it.

Return status of the priority queue.

Tirex::Queue, Tirex::Job

2023-04-11 perl v5.36.0