---
name: "pthread_rwlock_unlock"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd", "macos"]
url: "https://new.carta.tech/pthread_rwlock_unlock"
---

# pthread\_rwlock\_unlock(3)

release a read/write lock

## NAME

**pthread\_rwlock\_unlock** – release a read/write lock

## LIBRARY

POSIX Threads Library (libpthread, -lpthread)

## SYNOPSIS

**#include \<pthread.h\>**

*int*\

**pthread\_rwlock\_unlock**(*pthread\_rwlock\_t \*lock*);

## DESCRIPTION

The **pthread\_rwlock\_unlock**() function is used to release the read/write lock previously obtained by **pthread\_rwlock\_rdlock**(), **pthread\_rwlock\_wrlock**(), **pthread\_rwlock\_tryrdlock**(), or **pthread\_rwlock\_trywrlock**().

## RETURN VALUES

If successful, the **pthread\_rwlock\_unlock**() function will return zero. Otherwise an error number will be returned to indicate the error.

The results are undefined if *lock* is not held by the calling thread.

## ERRORS

The **pthread\_rwlock\_unlock**() function may fail if:

- \[EINVAL\]

  The value specified by *lock* is invalid.

- \[EPERM\]

  The current thread does not own the read/write lock.

## SEE ALSO

[pthread\_rwlock\_rdlock(3)](/pthread_rwlock_rdlock/3.md), [pthread\_rwlock\_wrlock(3)](/pthread_rwlock_wrlock/3.md)

## STANDARDS

The **pthread\_rwlock\_unlock**() function is expected to conform to Version 2 of the Single UNIX Specification (“SUSv2”).

## HISTORY

The **pthread\_rwlock\_unlock**() function first appeared in FreeBSD 3.0.
