---
name: "qb_thread_lock_create"
section: "3"
platform: "linux"
package: "libqb"
version: "2.0.10-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/qb_thread_lock_create"
---

# qb\_thread\_lock\_create(3)

Create a new lock of the given type.

## NAME

qb\_thread\_lock\_create - Create a new lock of the given type.

## SYNOPSIS

```
#include <qb/qbutil.h>

qb_thread_lock_t * qb_thread_lock_create(
    /*
     * QB_THREAD_LOCK_SHORT == spinlock (where available, else mutex)
     * QB_THREAD_LOCK_LONG == mutex
     */
    qb_thread_lock_type_t  type
);
```

## PARAMS

**type** *QB\_THREAD\_LOCK\_SHORT == spinlock (where available, else mutex) QB\_THREAD\_LOCK\_LONG == mutex*

## DESCRIPTION

## STRUCTURES

```
enum qb_thread_lock_type_t {
      QB_THREAD_LOCK_SHORT;
      QB_THREAD_LOCK_LONG;
};
```

## RETURN VALUE

*pointer to qb\_thread\_lock\_type\_t* or NULL on error.

## SEE ALSO

[*qb\_util\_nano\_current\_get*(3)](/qb_util_nano_current_get/3.md), [*qb\_util\_stopwatch\_stop*(3)](/qb_util_stopwatch_stop/3.md), [*qb\_util\_stopwatch\_split*(3)](/qb_util_stopwatch_split/3.md), [*qb\_util\_stopwatch\_split\_ctl*(3)](/qb_util_stopwatch_split_ctl/3.md), [*qb\_thread\_unlock*(3)](/qb_thread_unlock/3.md), [*qb\_strerror\_r*(3)](/qb_strerror_r/3.md), [*qb\_util\_stopwatch\_time\_split\_get*(3)](/qb_util_stopwatch_time_split_get/3.md), [*qb\_util\_set\_log\_function*(3)](/qb_util_set_log_function/3.md), [*qb\_util\_timespec\_from\_epoch\_get*(3)](/qb_util_timespec_from_epoch_get/3.md), [*qb\_thread\_lock\_destroy*(3)](/qb_thread_lock_destroy/3.md), [*qb\_thread\_trylock*(3)](/qb_thread_trylock/3.md), [*qb\_util\_nano\_monotonic\_hz*(3)](/qb_util_nano_monotonic_hz/3.md), [*qb\_util\_nano\_from\_epoch\_get*(3)](/qb_util_nano_from_epoch_get/3.md), [*qb\_util\_stopwatch\_create*(3)](/qb_util_stopwatch_create/3.md), [*qb\_util\_stopwatch\_split\_last*(3)](/qb_util_stopwatch_split_last/3.md), [*qb\_thread\_lock*(3)](/qb_thread_lock/3.md), [*qb\_util\_stopwatch\_free*(3)](/qb_util_stopwatch_free/3.md), [*qb\_timespec\_add\_ms*(3)](/qb_timespec_add_ms/3.md), [*qb\_util\_stopwatch\_start*(3)](/qb_util_stopwatch_start/3.md), [*qb\_util\_stopwatch\_us\_elapsed\_get*(3)](/qb_util_stopwatch_us_elapsed_get/3.md), [*qb\_util\_stopwatch\_sec\_elapsed\_get*(3)](/qb_util_stopwatch_sec_elapsed_get/3.md)

## COPYRIGHT

Copyright (C) 2010-2020 Red Hat, Inc.
