rte_ticketlock.h(3)
π rte_ticketlock.h(3) β like, the whole manual, bestie
okay so this is rte_ticketlock.h(3) from the Library Functions Manual and honestly? it's giving "queue at the club but make it threads" β¨ buckle up, we're going through everything, no skips, no cap π
π NAME π
rte_ticketlock.h β that's it, that's the name, she's iconic like that π
β¨ SYNOPSIS β¨
the vibes start here, with the includes you literally cannot skip:
#include <rte_common.h>
#include <rte_lcore.h>
#include <rte_pause.h>
#include <rte_stdatomic.h>
π¦ Data Structures
union rte_ticketlock_tβ the moment, the main character π«Ά
πΈ Macros
#define RTE_TICKETLOCK_INITIALIZER { 0 }#define TICKET_LOCK_INVALID_ID -1#define RTE_TICKETLOCK_RECURSIVE_INITIALIZER
β Functions
static void rte_ticketlock_init (rte_ticketlock_t *tl)
static void rte_ticketlock_lock (rte_ticketlock_t *tl)
static void rte_ticketlock_unlock (rte_ticketlock_t *tl)
static int rte_ticketlock_trylock (rte_ticketlock_t *tl)
static int rte_ticketlock_is_locked (rte_ticketlock_t *tl)
static void rte_ticketlock_recursive_init (rte_ticketlock_recursive_t *tlr)
static void rte_ticketlock_recursive_lock (rte_ticketlock_recursive_t *tlr)
static void rte_ticketlock_recursive_unlock (rte_ticketlock_recursive_t *tlr)
static int rte_ticketlock_recursive_trylock (rte_ticketlock_recursive_t *tlr)
look at her go, nine little functions, all girlbosses π
π DETAILED DESCRIPTION π
k so, RTE ticket locks, bestie π₯
this file defines an API for ticket locks, and the whole concept is so satisfying: each waiting thread gets, like, a literal ticket ποΈ and they take the lock one by one, first come, first serviced. it's giving deli counter. it's giving DMV. it's giving fairness and we're obsessed π
β οΈ ok real talk: all locks must be initialised before use, and only initialised once. not twice. never twice. that's the rule, periodt π
definition in file rte_ticketlock.h.
π MACRO DEFINITION DOCUMENTATION π
#define RTE_TICKETLOCK_INITIALIZER { 0 }
a static ticketlock initializer β¨ so clean, so simple.
definition at line 43 of file rte_ticketlock.h.
#define TICKET_LOCK_INVALID_ID -1
the rte_ticketlock_recursive_t type π«Ά (yes that's literally what the doc says, we don't question the icon)
definition at line 128 of file rte_ticketlock.h.
#define RTE_TICKETLOCK_RECURSIVE_INITIALIZER
value:
{RTE_TICKETLOCK_INITIALIZER, \
TICKET_LOCK_INVALID_ID, 0}
a static recursive ticketlock initializer π she's got layers.
definition at line 139 of file rte_ticketlock.h.
π₯ FUNCTION DOCUMENTATION π₯
void rte_ticketlock_init (rte_ticketlock_t * tl) [inline], [static]
initialize the ticketlock to an unlocked state π€ like waking up with zero responsibilities.
Parameters
tlβ a pointer to the ticketlock.
definition at line 52 of file rte_ticketlock.h.
void rte_ticketlock_lock (rte_ticketlock_t * tl) [inline], [static]
take the ticketlock π you're in, bestie.
Parameters
tlβ a pointer to the ticketlock.
definition at line 64 of file rte_ticketlock.h.
void rte_ticketlock_unlock (rte_ticketlock_t * tl) [inline], [static]
release the ticketlock π¦ letting go is self care.
Parameters
tlβ a pointer to the ticketlock.
definition at line 78 of file rte_ticketlock.h.
int rte_ticketlock_trylock (rte_ticketlock_t * tl) [inline], [static]
try to take the lock π the "no pressure, but likeβ¦" of locking.
Parameters
tlβ a pointer to the ticketlock.
Returns
1 if the lock is successfully taken; 0 otherwise.
definition at line 93 of file rte_ticketlock.h.
int rte_ticketlock_is_locked (rte_ticketlock_t * tl) [inline], [static]
test if the lock is taken π vibe check, basically.
Parameters
tlβ a pointer to the ticketlock.
Returns
1 if the lock is currently taken; 0 otherwise.
definition at line 118 of file rte_ticketlock.h.
void rte_ticketlock_recursive_init (rte_ticketlock_recursive_t * tlr) [inline], [static]
initialize the recursive ticketlock to an unlocked state πΈ same energy, recursive flavour.
Parameters
tlrβ a pointer to the recursive ticketlock.
definition at line 149 of file rte_ticketlock.h.
void rte_ticketlock_recursive_lock (rte_ticketlock_recursive_t * tlr) [inline], [static]
take the recursive ticketlock π she can hold herself, it's fine, it's a whole thing.
Parameters
tlrβ a pointer to the recursive ticketlock.
definition at line 163 of file rte_ticketlock.h.
void rte_ticketlock_recursive_unlock (rte_ticketlock_recursive_t * tlr) [inline], [static]
release the recursive ticketlock π§ one layer at a time, bestie.
Parameters
tlrβ a pointer to the recursive ticketlock.
definition at line 181 of file rte_ticketlock.h.
int rte_ticketlock_recursive_trylock (rte_ticketlock_recursive_t * tlr) [inline], [static]
try to take the recursive lock π shoot your shot, recursively.
Parameters
tlrβ a pointer to the recursive ticketlock.
Returns
1 if the lock is successfully taken; 0 otherwise.
definition at line 199 of file rte_ticketlock.h.
π AUTHOR π
generated automatically by Doxygen for DPDK from the source code π€ not a human, but she ate anyway.
ok that's the whole page, every line number, every macro, every 1 and 0, nothing skipped π mwah π
sign-off: this masterpiece is DPDK β Version 26.03.0, page rte_ticketlock.h(3), and yes the header up top said rte_ticketlock.h(3) / Library Functions Manual too, we remembered π«Άβ¨π
π¦ where this page comes from
- nixos 26.05: dpdk 26.03
- nixpkgs unstable: dpdk 26.03
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms