---
name: "tdb_chainlock"
section: "3"
platform: "linux"
package: "libtdb-dev"
version: "2:1.4.13+samba4.22.11+dfsg-0+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/tdb_chainlock"
---

# tdb\_chainlock(3)

lock a group of keys tdb\_chainunlock - unlock a previously locked group of keys

## NAME

tdb\_chainlock - lock a group of keys tdb\_chainunlock - unlock a previously locked group of keys

## SYNOPSIS

```
#include <tdb.h>

int tdb_chainlock(TDB_CONTEXT *tdb, TDB_DATA key);
void tdb_chainunlock(TDB_CONTEXT *tdb, TDB_DATA key);

```

## DESCRIPTION

*tdb\_chainlock* is a low-level function used to lock a particular key (and a number of other keys) without any checking: any other process attempting to perform tdb operations on those keys will block until *tdb\_chainunlock* is called.

## NOTES

It is the user's responsibility to ensure that they do not deadlock the database using these functions: something which is impossible using the other access functions.

## RETURN VALUE

A return value of 0 indicates success and -1 indicates failure.

## AUTHORS

Software: Andrew Tridgell \<tridge@linuxcare.com\> Man page: Rusty.

## SEE ALSO

[**gdbm**(3)](/gdbm/3.md), [**tdb**(3)](/tdb/3.md), **tdb\_lockall**(3).
