File indexing completed on 2026-05-06 08:41:16
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 #ifndef __G_BITLOCK_H__
0024 #define __G_BITLOCK_H__
0025
0026 #include <glib/gtypes.h>
0027
0028 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
0029 #error "Only <glib.h> can be included directly."
0030 #endif
0031
0032 G_BEGIN_DECLS
0033
0034 GLIB_AVAILABLE_IN_ALL
0035 void g_bit_lock (volatile gint *address,
0036 gint lock_bit);
0037 GLIB_AVAILABLE_IN_2_86
0038 void g_bit_lock_and_get (gint *address,
0039 guint lock_bit,
0040 gint *out_val);
0041
0042 GLIB_AVAILABLE_IN_ALL
0043 gboolean g_bit_trylock (volatile gint *address,
0044 gint lock_bit);
0045 GLIB_AVAILABLE_IN_ALL
0046 void g_bit_unlock (volatile gint *address,
0047 gint lock_bit);
0048
0049 GLIB_AVAILABLE_IN_2_86
0050 void g_bit_unlock_and_set (gint *address,
0051 guint lock_bit,
0052 gint new_val,
0053 gint preserve_mask);
0054
0055 GLIB_AVAILABLE_IN_ALL
0056 void g_pointer_bit_lock (volatile void *address,
0057 gint lock_bit);
0058
0059 GLIB_AVAILABLE_IN_2_80
0060 void g_pointer_bit_lock_and_get (gpointer address,
0061 guint lock_bit,
0062 guintptr *out_ptr);
0063
0064 GLIB_AVAILABLE_IN_ALL
0065 gboolean g_pointer_bit_trylock (volatile void *address,
0066 gint lock_bit);
0067 GLIB_AVAILABLE_IN_ALL
0068 void g_pointer_bit_unlock (volatile void *address,
0069 gint lock_bit);
0070
0071 GLIB_AVAILABLE_IN_2_80
0072 gpointer g_pointer_bit_lock_mask_ptr (gpointer ptr,
0073 guint lock_bit,
0074 gboolean set,
0075 guintptr preserve_mask,
0076 gpointer preserve_ptr);
0077
0078 GLIB_AVAILABLE_IN_2_80
0079 void g_pointer_bit_unlock_and_set (void *address,
0080 guint lock_bit,
0081 gpointer ptr,
0082 guintptr preserve_mask);
0083
0084 #ifdef __GNUC__
0085
0086 #define g_pointer_bit_lock(address, lock_bit) \
0087 (G_GNUC_EXTENSION ({ \
0088 G_STATIC_ASSERT (sizeof *(address) == sizeof (gpointer)); \
0089 g_pointer_bit_lock ((address), (lock_bit)); \
0090 }))
0091
0092 #define g_pointer_bit_lock_and_get(address, lock_bit, out_ptr) \
0093 (G_GNUC_EXTENSION ({ \
0094 G_STATIC_ASSERT (sizeof *(address) == sizeof (gpointer)); \
0095 g_pointer_bit_lock_and_get ((address), (lock_bit), (out_ptr)); \
0096 }))
0097
0098 #define g_pointer_bit_trylock(address, lock_bit) \
0099 (G_GNUC_EXTENSION ({ \
0100 G_STATIC_ASSERT (sizeof *(address) == sizeof (gpointer)); \
0101 g_pointer_bit_trylock ((address), (lock_bit)); \
0102 }))
0103
0104 #define g_pointer_bit_unlock(address, lock_bit) \
0105 (G_GNUC_EXTENSION ({ \
0106 G_STATIC_ASSERT (sizeof *(address) == sizeof (gpointer)); \
0107 g_pointer_bit_unlock ((address), (lock_bit)); \
0108 }))
0109
0110 #define g_pointer_bit_unlock_and_set(address, lock_bit, ptr, preserve_mask) \
0111 (G_GNUC_EXTENSION ({ \
0112 G_STATIC_ASSERT (sizeof *(address) == sizeof (gpointer)); \
0113 g_pointer_bit_unlock_and_set ((address), (lock_bit), (ptr), (preserve_mask)); \
0114 }))
0115
0116 #endif
0117
0118 G_END_DECLS
0119
0120 #endif