### Function

# GLib pointer_bit_lock_and_get

since: 2.80

#### Declaration

    void
    g_pointer_bit_lock_and_get (
      gpointer address,
      guint lock_bit,
      guintptr* out_ptr
    )

#### Description

This is equivalent to g_bit_lock, but working on pointers (or other pointer-sized values).

For portability reasons, you may only lock on the bottom 32 bits of the pointer.

Available since: 2.80

#### Parameters

`address`

  Type: `gpointer`

  A pointer to a #gpointer-sized value.

  The data is owned by the caller of the function.

`lock_bit`

  Type: `guint`

  A bit value between 0 and 31

`out_ptr`

  Type: `guintptr*`

  Returns the set pointer atomically. This is the value after setting the lock, it thus always has the lock bit set, while previously `address` had the lockbit unset. You may also use `g_pointer_bit_lock_mask_ptr()` to clear the lock bit.

  The argument will be set by the function.
  The argument can be `NULL`.
  The caller of the function takes ownership of the data, and is responsible for freeing it.