---
name: "rte_pflock_write_lock"
section: "3"
platform: "linux"
package: "dpdk-doc"
version: "24.11.4-0+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rte_pflock.h"
---

# rte\_pflock\_write\_lock(3)

Part of [rte\_pflock.h(3)](/rte_pflock.h/3.md).

## NAME

rte\_pflock.h

## SYNOPSIS

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

### Data Structures

struct **rte\_pflock**\

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

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

### #define RTE\_PFLOCK\_INITIALIZER { }

A static pflock initializer.

Definition at line **79** of file **rte\_pflock.h**.

## Function Documentation

### static void rte\_pflock\_init (struct rte\_pflock \* pf)` [inline]`, ` [static]`

Initialize the pflock to an unlocked state.

**Parameters**

*pf* A pointer to the pflock.

Definition at line **88** of file **rte\_pflock.h**.

### static void rte\_pflock\_read\_lock (rte\_pflock\_t \* pf)` [inline]`, ` [static]`

Take a pflock for read.

**Parameters**

*pf* A pointer to a pflock structure.

Definition at line **103** of file **rte\_pflock.h**.

### static void rte\_pflock\_read\_unlock (rte\_pflock\_t \* pf)` [inline]`, ` [static]`

Release a pflock locked for reading.

**Parameters**

*pf* A pointer to the pflock structure.

Definition at line **127** of file **rte\_pflock.h**.

### static void rte\_pflock\_write\_lock (rte\_pflock\_t \* pf)` [inline]`, ` [static]`

Take the pflock for write.

**Parameters**

*pf* A pointer to the pflock structure.

Definition at line **139** of file **rte\_pflock.h**.

### static void rte\_pflock\_write\_unlock (rte\_pflock\_t \* pf)` [inline]`, ` [static]`

Release a pflock held for writing.

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