---
name: "pthread_rwlock_destroy"
section: "3"
platform: "macos"
package: "libpthread"
version: "539.100.4"
release: "macOS 26.5"
platforms: ["freebsd", "macos"]
url: "https://new.carta.tech/pthread_rwlock_destroy"
---

# pthread\_rwlock\_destroy(3)

destroy a read/write lock

## NAME

**pthread\_rwlock\_destroy** – destroy a read/write lock

## SYNOPSIS

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

*int*\

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

## DESCRIPTION

The **pthread\_rwlock\_destroy**() function is used to destroy a read/write lock previously created with **pthread\_rwlock\_init**().

## RETURN VALUES

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

## ERRORS

The **pthread\_rwlock\_destroy**() function will fail if:

- \[EPERM\]

  The caller does not have the privilege to perform the operation.

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

- \[EBUSY\]

  The system has detected an attempt to destroy the object referenced by *lock* while it is locked.

- \[EINVAL\]

  The value specified by *lock* is invalid.

## SEE ALSO

[pthread\_rwlock\_init(3)](/pthread_rwlock_init/3.md)

## STANDARDS

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

## HISTORY

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