rte_pflock.h(3)

πŸ’– rte_pflock.h β€” the phase-fair lock header, bestie edition ✨

okay so rte_pflock.h is a manual page for a header file in DPDK, and honestly? she's giving very demure, very mindful reader-writer lock energy. it's a header. it defines structs, a macro, and five lil functions. that's it. that's the whole vibe. and yet she prevents starvation, which is highkey iconic of her. πŸŽ€


🌸 SYNOPSIS 🌸

like, include these first or you're literally on your own:

#include <rte_common.h>
#include <rte_pause.h>
#include <rte_stdatomic.h>

πŸ¦‹ Data Structures

  • struct rte_pflock β€” the lock itself, the main character

🧚 Macros

#define RTE_PFLOCK_INITIALIZER   {  }

⭐ Functions

static void rte_pflock_init (struct rte_pflock *pf)
static void rte_pflock_read_lock (rte_pflock_t *pf)
static void rte_pflock_read_unlock (rte_pflock_t *pf)
static void rte_pflock_write_lock (rte_pflock_t *pf)
static void rte_pflock_write_unlock (rte_pflock_t *pf)

πŸ‘‘ Detailed Description πŸ‘‘

Phase-fair locks πŸ’…

this file defines an API for phase-fair reader writer locks, which is a variant of typical reader-writer locks that prevent starvation. in this type of lock, readers and writers alternate. this significantly reduces the worst-case blocking for readers and writers. no cap, that's the whole point. 🫢

this is an implementation derived from FreeBSD, based on the work described in: Brandenburg, B. and Anderson, J. 2010. Spin-Based Reader-Writer Synchronization for Multiprocessor Real-Time Systems πŸ“š

⚠️ okay listen bestie, this part matters: all locks must be initialised before use, and only initialised once. only once. not twice. one time. that's it. if you double-init you're on your own fr fr 😭

Definition in file rte_pflock.h.


πŸŽ€ Macro Definition Documentation πŸŽ€

#define RTE_PFLOCK_INITIALIZER { }

a static pflock initializer. cute, empty, does the job. ✨

Definition at line 79 of file rte_pflock.h.


πŸ’œ Function Documentation πŸ’œ

void rte_pflock_init (struct rte_pflock * pf) [inline], [static]

initialize the pflock to an unlocked state. the "hi bestie welcome to the world" moment. 🌱

Parameters

  • pf β€” a pointer to the pflock.

Definition at line 88 of file rte_pflock.h.


void rte_pflock_read_lock (rte_pflock_t * pf) [inline], [static]

take a pflock for read. grab it, read your stuff, it's giving shared access. πŸ“–

Parameters

  • pf β€” a pointer to a pflock structure.

Definition at line 103 of file rte_pflock.h.


void rte_pflock_read_unlock (rte_pflock_t * pf) [inline], [static]

release a pflock locked for reading. put it back, you're done, thank u next. πŸ¦‹

Parameters

  • pf β€” a pointer to the pflock structure.

Definition at line 127 of file rte_pflock.h.


void rte_pflock_write_lock (rte_pflock_t * pf) [inline], [static]

take the pflock for write. exclusive access era, nobody else is getting in here. πŸ”₯

Parameters

  • pf β€” a pointer to the pflock structure.

Definition at line 139 of file rte_pflock.h.


void rte_pflock_write_unlock (rte_pflock_t * pf) [inline], [static]

release a pflock held for writing. you're free, go touch grass. 🌸

Parameters

  • pf β€” a pointer to a pflock structure.

Definition at line 173 of file rte_pflock.h.


🫢 Author 🫢

generated automatically by Doxygen for DPDK from the source code. so like, not a human author, a robot did this. respecting the grind tho. πŸ’€


aaaand that's the page bestie, tysm for reading the whole thing <3 this was DPDK, Version 25.11.3, manual page rte_pflock.h(3) β€” no notes, she ate, periodt. πŸ’…πŸ’–πŸŒˆ

πŸ“¦ where this page comes from