rte_mcslock.h(3)

✨ NAME ✨

okay so bestie, quick lil intro β€” this is the Library Functions Manual page for rte_mcslock.h, and it's giving "the MCS queued lock header, your new fave" πŸ’… she's the file that defines the main data structure and the APIs for the MCS queued lock, and yes she is iconic.


πŸ“š SYNOPSIS πŸ“š

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

πŸ‘‘ Data Structures

  • struct rte_mcslock

πŸ¦‹ Typedefs

  • typedef struct rte_mcslock rte_mcslock_t

πŸ’… Functions

static void rte_mcslock_lock (1(rte_mcslock_t *) *msl, rte_mcslock_t *me)
static void rte_mcslock_unlock (1(rte_mcslock_t *) *msl, 1(rte_mcslock_t *) me)
static int rte_mcslock_trylock (1(rte_mcslock_t *) *msl, rte_mcslock_t *me)
static int rte_mcslock_is_locked (1(rte_mcslock_t *) msl)

🌸 Detailed Description 🌸

RTE MCS lock β€” periodt.

So like, this file defines the main data structure and the APIs for the MCS queued lock, and she's kind of a big deal ✨

The MCS lock (proposed by John M. Mellor-Crummey and Michael L. Scott) is the girl who stays scalable by spinning on a CPU/thread local variable, which avoids those expensive cache bouncings 😭 no more cache chaos fr fr. And she's fair too β€” she keeps a list of acquirers and passes the lock to each CPU/thread in the exact order they acquired the lock. queen behavior πŸ‘‘

Definition in file rte_mcslock.h.


πŸŽ€ Typedef Documentation πŸŽ€

typedef struct rte_mcslock rte_mcslock_t

The rte_mcslock_t type. short, sweet, slayed πŸ’–


🫢 Function Documentation 🫢

void rte_mcslock_lock (1(rte_mcslock_t *) *msl, rte_mcslock_t *me)

[inline], [static]

Take the MCS lock. go on, grab her πŸ”₯

Parameters

  • msl β€” a pointer to the pointer of a MCS lock. When the lock is initialized or declared, the msl pointer should be set to NULL. (yes bestie, set it to NULL or she will not be your friend πŸ™ˆ)
  • me β€” a pointer to a new node of MCS lock. Each CPU/thread acquiring the lock should use its 'own node'. no sharing, sharing is not caring here ok?

Definition at line 52 of file rte_mcslock.h.


void rte_mcslock_unlock (1(rte_mcslock_t *) *msl, 1(rte_mcslock_t *) me)

[inline], [static]

Release the MCS lock. let her go, freedom πŸ’«

Parameters

  • msl β€” a pointer to the pointer of a MCS lock.
  • me β€” a pointer to the node of MCS lock passed in rte_mcslock_lock.

Definition at line 116 of file rte_mcslock.h.


int rte_mcslock_trylock (1(rte_mcslock_t *) *msl, rte_mcslock_t *me)

[inline], [static]

Try to take the lock. lowkey the respectful version β€” ask, don't block 🌈

Parameters

  • msl β€” a pointer to the pointer of a MCS lock.
  • me β€” a pointer to a new node of MCS lock.

Returns

1 if the lock is successfully taken; 0 otherwise. that's it, that's the vibe check βœ…

Definition at line 172 of file rte_mcslock.h.


int rte_mcslock_is_locked (1(rte_mcslock_t *) msl)

[inline], [static]

Test if the lock is taken. just peeking, no touching πŸ‘€

Parameters

  • msl β€” a pointer to a MCS lock node.

Returns

1 if the lock is currently taken; 0 otherwise. fr fr.

Definition at line 199 of file rte_mcslock.h.


⭐ Author ⭐

Generated automatically by Doxygen for DPDK from the source code. not a human, just a very diligent little robot πŸŽ€


and that's the whole page bestie, no gatekeeping here πŸ’–

okay so final lil sign-off: this was DPDK, Version 25.11.3, serving Library Functions Manual energy for rte_mcslock.h(3) β€” go forth and lock responsibly, mwah πŸ’…βœ¨

πŸ“¦ where this page comes from