MySQL 8.0.39
Source Code Documentation
queues.cc File Reference

Code for handling of priority Queues. More...

#include "storage/myisam/queues.h"
#include <stddef.h>
#include <stdio.h>
#include <sys/types.h>
#include <algorithm>
#include "my_dbug.h"
#include "my_macros.h"
#include "my_sys.h"
#include "my_systime.h"
#include "mysql/service_mysql_alloc.h"
#include "storage/myisam/myisamdef.h"

Functions

static int resize_queue (QUEUE *queue, PSI_memory_key key, uint max_elements)
 
int init_queue (QUEUE *queue, PSI_memory_key psi_key, uint max_elements, uint offset_to_key, bool max_at_top, int(*compare)(void *, uchar *, uchar *), void *first_cmp_arg)
 
int reinit_queue (QUEUE *queue, PSI_memory_key psi_key, uint max_elements, uint offset_to_key, bool max_at_top, int(*compare)(void *, uchar *, uchar *), void *first_cmp_arg)
 
void delete_queue (QUEUE *queue)
 
void queue_insert (QUEUE *queue, uchar *element)
 
ucharqueue_remove (QUEUE *queue, uint idx)
 
void _downheap (QUEUE *queue, uint idx)
 
void queue_fix (QUEUE *queue)
 

Detailed Description

Code for handling of priority Queues.

Implementation of queues from "Algorithms in C" by Robert Sedgewick. An optimisation of _downheap suggested in Exercise 7.51 in "Data Structures & Algorithms in C++" by Mark Allen Weiss, Second Edition was implemented by Mikael Ronstrom 2005. Also the O(N) algorithm of queue_fix was implemented.

Function Documentation

◆ _downheap()

void _downheap ( QUEUE queue,
uint  idx 
)

◆ delete_queue()

void delete_queue ( QUEUE queue)

◆ init_queue()

int init_queue ( QUEUE queue,
PSI_memory_key  psi_key,
uint  max_elements,
uint  offset_to_key,
bool  max_at_top,
int(*)(void *, uchar *, uchar *)  compare,
void *  first_cmp_arg 
)

◆ queue_fix()

void queue_fix ( QUEUE queue)

◆ queue_insert()

void queue_insert ( QUEUE queue,
uchar element 
)

◆ queue_remove()

uchar * queue_remove ( QUEUE queue,
uint  idx 
)

◆ reinit_queue()

int reinit_queue ( QUEUE queue,
PSI_memory_key  psi_key,
uint  max_elements,
uint  offset_to_key,
bool  max_at_top,
int(*)(void *, uchar *, uchar *)  compare,
void *  first_cmp_arg 
)

◆ resize_queue()

static int resize_queue ( QUEUE queue,
PSI_memory_key  key,
uint  max_elements 
)
static