### Function

# GLib pointer_bit_lock_mask_ptr

since: 2.80

#### Declaration

    gpointer
    g_pointer_bit_lock_mask_ptr (
      gpointer ptr,
      guint lock_bit,
      gboolean set,
      guintptr preserve_mask,
      gpointer preserve_ptr
    )

#### Description

This mangles `ptr` as `g_pointer_bit_lock()` and `g_pointer_bit_unlock()` do.

Available since: 2.80

#### Parameters

`ptr`

  Type: `gpointer`

  The pointer to mask.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`lock_bit`

  Type: `guint`

  The bit to set/clear. If set to `G_MAXUINT`, the lockbit is taken from `preserve_ptr` or `ptr` (depending on `preserve_mask`).

`set`

  Type: `gboolean`

  Whether to set (lock) the bit or unset (unlock). This has no effect, if `lock_bit` is set to `G_MAXUINT`.

`preserve_mask`

  Type: `guintptr`

  If non-zero, a bit-mask for `preserve_ptr`. The `preserve_mask` bits from `preserve_ptr` are set in the result. Note that the `lock_bit` bit will be always set according to `set`, regardless of `preserve_mask` and `preserve_ptr` (unless `lock_bit` is `G_MAXUINT`).

`preserve_ptr`

  Type: `gpointer`

  If `preserve_mask` is non-zero, the bits from this pointer are set in the result.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

#### Return value

Type: `gpointer`

The mangled pointer.

The data is owned by the called function.
The return value can be `NULL`.