Function

GLibatomic_int_dec_and_test

since: 2.4

Declaration

gboolean
g_atomic_int_dec_and_test (
  volatile gint* atomic
)

Description

Decrements the value of atomic by 1.

Think of this operation as an atomic version of { *atomic -= 1; return (*atomic == 0); }.

This call acts as a full compiler and hardware memory barrier.

While atomic has a volatile qualifier, this is a historical artifact and the pointer passed to it should not be volatile.

Available since: 2.4

Parameters

atomic

Type: volatile gint*

A pointer to a #gint or #guint.

The data is owned by the caller of the function.

Return value

Type: gboolean

TRUE if the resultant value is zero.