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
- 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