### Function

# GLib bit_unlock_and_set

since: 2.86

#### Declaration [src]

    void
    g_bit_unlock_and_set (
      gint* address,
      guint lock_bit,
      gint new_val,
      gint preserve_mask
    )

#### Description [src]

This is like `g_bit_unlock()` but also atomically sets `address` to `val`.

If `preserve_mask` is not zero, then the `preserve_mask` bits will be preserved in `address` and are not set to `val`.

Note that the `lock_bit` bit will always be unset regardless of `val`, `preserve_mask` and the currently set value in `address`.

Available since: 2.86

#### Parameters

`address`

  Type: `gint*`

  A pointer to an integer.

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

`lock_bit`

  Type: `guint`

  A bit value between 0 and 31.

`new_val`

  Type: `gint`

  The new value to set.

`preserve_mask`

  Type: `gint`

  Mask for bits from `address` to preserve.