1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

cleanup: Queue and Bounded_queue

Bounded_queue<> pretended to be a typesafe C++ wrapper
on top of pure C queues.h.

But it wasn't, it was tightly bounded to filesort and only useful there.

* implement Queue<> - a typesafe C++ wrapper on top of QUEUE
* move Bounded_queue to filesort.cc, remove pointless "generalizations"
  change it to use Queue.
* remove bounded_queue.h
* change subselect_rowid_merge_engine to use Queue, not QUEUE
This commit is contained in:
Sergei Golubchik
2024-02-07 00:15:45 +01:00
parent ae59127158
commit f5e9c4e9ef
7 changed files with 155 additions and 260 deletions

View File

@@ -65,7 +65,7 @@ class PROFILING;
Implements a persistent FIFO using server List method names. Not
thread-safe. Intended to be used on thread-local data only.
*/
template <class T> class Queue
template <class T> class FIFO_Queue
{
private:
@@ -78,7 +78,7 @@ private:
struct queue_item *first, *last;
public:
Queue()
FIFO_Queue()
{
elements= 0;
first= last= NULL;
@@ -95,7 +95,7 @@ public:
elements= 0;
}
ulong elements; /* The count of items in the Queue */
ulong elements; /* The count of items in the FIFO_Queue */
void push_back(T *payload)
{
@@ -129,7 +129,7 @@ public:
if (first == NULL)
{
DBUG_PRINT("warning", ("tried to pop nonexistent item from Queue"));
DBUG_PRINT("warning", ("tried to pop nonexistent item from FIFO_Queue"));
return NULL;
}
@@ -228,7 +228,7 @@ private:
double m_start_time_usecs;
double m_end_time_usecs;
ulong m_seq_counter;
Queue<PROF_MEASUREMENT> entries;
FIFO_Queue<PROF_MEASUREMENT> entries;
QUERY_PROFILE(PROFILING *profiling_arg, const char *status_arg);
@@ -268,7 +268,7 @@ private:
QUERY_PROFILE *current;
QUERY_PROFILE *last;
Queue<QUERY_PROFILE> history;
FIFO_Queue<QUERY_PROFILE> history;
query_id_t next_profile_id() { return(profile_id_counter++); }