rte_ticketlock.h(3)
π rte_ticketlock.h β the library functions manual page, but make it cute β¨
okay so bestie, we're in rte_ticketlock.h(3) territory, living under the Library Functions Manual umbrella, and this is literally the page where DPDK keeps its ticket locks. grab a snack, we're doing this π
πΈ NAME πΈ
rte_ticketlock.h β that's it, that's the name, she's self-titled and she knows it π
β¨ SYNOPSIS β¨
first things first, you gotta pull in the girlies:
#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 icon
π¦ 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)
π Detailed Description π
RTE ticket locks β no cap, this file defines an API for ticket locks, and the whole system is giving deli counter energy: every waiting thread gets a ticket, and they take the lock one by one, first come, first serviced. It's fair, it's orderly, it's the main character of synchronization primitives π
π¨ not me being serious for one sec: all locks must be initialised before use, and only initialised once. that's non-negotiable bestie, do NOT double-init her.
Definition in file rte_ticketlock.h.
π§ Macro Definition Documentation π§
#define RTE_TICKETLOCK_INITIALIZER { 0 }
a static ticketlock initializer. so clean, so simple, zero drama β¨
Definition at line 43 of file rte_ticketlock.h.
#define TICKET_LOCK_INVALID_ID -1
the rte_ticketlock_recursive_t type. yes she said -1, the invalid ID, the "nobody's home" ticket π
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. it's the stacked version, she contains multitudes π
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. fresh start, glowing skin, unlocked β¨
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. your ticket's up, step to the counter queen π
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. hand it back, be polite, let the next girl go π«Ά
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. lowkey a "do you want me or not" situation, and she'll tell you immediately, no waiting around π
Parameters
- tl β a pointer to the ticketlock.
Returns
1if the lock is successfully taken;0otherwise.
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, but for locks π
Parameters
- tl β a pointer to the ticketlock.
Returns
1if the lock is currently taken;0otherwise.
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, but now she's recursive π
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 and also herself, it's iconic πΈ
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. unwinding the whole stack, gracefully π
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. the "hey bestie, are you free" of it all β¨
Parameters
- tlr β a pointer to the recursive ticketlock.
Returns
1if the lock is successfully taken;0otherwise.
Definition at line 199 of file rte_ticketlock.h.
π Author π
Generated automatically by Doxygen for DPDK from the source code. not a human author, just a robot doing her thing π
okay so that's literally the whole page, and to close it out: this came to you courtesy of DPDK, Version 25.11.3, dated right alongside rte_ticketlock.h(3). slay, go lock something (responsibly, after initialising it, exactly once) π¦π periodt
π¦ where this page comes from
- ubuntu resolute: dpdk-doc 25.11.3-0ubuntu0.26.04.1 Β· BSD-3-Clause
- ubuntu stonking: dpdk-doc 25.11.3-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms