Function

GLibbit_lock

since: 2.24

Declaration

void
g_bit_lock (
  volatile gint* address,
  gint lock_bit
)

Description

Sets the indicated lock_bit in address. If the bit is already set, this call will block until g_bit_unlock() unsets the corresponding bit.

Attempting to lock on two different bits within the same integer is not supported and will very probably cause deadlocks.

The value of the bit that is set is (1u << bit). If bit is not between 0 and 31 then the result is undefined.

This function accesses address atomically. All other accesses to address must be atomic in order for this function to work reliably. While address has a volatile qualifier, this is a historical artifact and the argument passed to it should not be volatile.

Available since: 2.24

Parameters

address

Type: volatile gint*

A pointer to an integer.

The data is owned by the caller of the function.
lock_bit

Type: gint

A bit value between 0 and 31