rte_ticketlock.h(3)

πŸ“¦ version 26.03, in nixos 26.05, nixpkgs unstable

πŸ’… 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