DPDK  22.07.0
Data Structures | Macros | Functions
rte_pflock.h File Reference
#include <rte_common.h>
#include <rte_pause.h>

Go to the source code of this file.

Data Structures

struct  rte_pflock
 

Macros

#define RTE_PFLOCK_INITIALIZER   { }
 

Functions

static __rte_experimental void rte_pflock_init (struct rte_pflock *pf)
 
static __rte_experimental void rte_pflock_read_lock (rte_pflock_t *pf)
 
static __rte_experimental void rte_pflock_read_unlock (rte_pflock_t *pf)
 
static __rte_experimental void rte_pflock_write_lock (rte_pflock_t *pf)
 
static __rte_experimental 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.

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

All locks must be initialised before use, and only initialised once.

Definition in file rte_pflock.h.

Macro Definition Documentation

◆ RTE_PFLOCK_INITIALIZER

#define RTE_PFLOCK_INITIALIZER   { }

A static pflock initializer.

Definition at line 78 of file rte_pflock.h.

Function Documentation

◆ rte_pflock_init()

static __rte_experimental void rte_pflock_init ( struct rte_pflock pf)
inlinestatic
Warning
EXPERIMENTAL: this API may change without prior notice.

Initialize the pflock to an unlocked state.

Parameters
pfA pointer to the pflock.

Definition at line 91 of file rte_pflock.h.

◆ rte_pflock_read_lock()

static __rte_experimental void rte_pflock_read_lock ( rte_pflock_t pf)
inlinestatic
Warning
EXPERIMENTAL: this API may change without prior notice.

Take a pflock for read.

Parameters
pfA pointer to a pflock structure.

Definition at line 110 of file rte_pflock.h.

◆ rte_pflock_read_unlock()

static __rte_experimental void rte_pflock_read_unlock ( rte_pflock_t pf)
inlinestatic
Warning
EXPERIMENTAL: this API may change without prior notice.

Release a pflock locked for reading.

Parameters
pfA pointer to the pflock structure.

Definition at line 139 of file rte_pflock.h.

◆ rte_pflock_write_lock()

static __rte_experimental void rte_pflock_write_lock ( rte_pflock_t pf)
inlinestatic
Warning
EXPERIMENTAL: this API may change without prior notice.

Take the pflock for write.

Parameters
pfA pointer to the pflock structure.

Definition at line 155 of file rte_pflock.h.

◆ rte_pflock_write_unlock()

static __rte_experimental void rte_pflock_write_unlock ( rte_pflock_t pf)
inlinestatic
Warning
EXPERIMENTAL: this API may change without prior notice.

Release a pflock held for writing.

Parameters
pfA pointer to a pflock structure.

Definition at line 191 of file rte_pflock.h.