Go to the source code of this file.
◆ queue_free
◆ q_t
◆ qnode_t
◆ dequeue()
| void * dequeue |
( |
q_t * |
q | ) |
|
|
extern |
◆ enqueue()
◆ prequeue()
◆ queue_destroy()
| void queue_destroy |
( |
q_t * |
q, |
|
|
void(*)(void *) |
callback |
|
) |
| |
|
extern |
◆ queue_init()
| q_t * queue_init |
( |
void |
| ) |
|
|
extern |
◆ queue_move_to_tail()
Move existing node to tail (MRU) without reallocation.
This function provides O(1) move-to-tail operation without malloc/free overhead. Used by ARC cache to efficiently update T2 on cache hits.
- Parameters
-
| [in] | q | Queue (circular doubly-linked list with sentinel) |
| [in] | node | Node to move to tail (must currently be in queue q) |
- Returns
- The same node pointer (now at tail/MRU), or NULL on error
- Note
- The node pointer remains valid and unchanged - only its position changes
-
If node is already at tail, this is a no-op (fast path)
-
This is thread-safe if external locking is used (same as other queue ops)
◆ queue_move_to_tail_of()
Move node from one queue to another without memory reallocation.
Removes node from source queue and adds it to tail of destination queue. The node pointer remains valid and unchanged - enables zero-allocation transitions between ARC lists (T1→T2, T1→B1, T2→B2, B1→T2, B2→T2).
- Parameters
-
| [in] | from_q | Source queue (node must be in this queue) |
| [in] | to_q | Destination queue |
| [in] | node | Node to move |
- Returns
- The same node pointer (now in dest queue), or NULL on error