gwin32: Remove old win32 codepage ABI compat code
[glib.git] / glib / gbitlock.h
blob5fab49494f5835095280476fb8609860f959e884
1 /*
2 * Copyright © 2008 Ryan Lortie
3 * Copyright © 2010 Codethink Limited
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the licence, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18 * Author: Ryan Lortie <desrt@desrt.ca>
21 #ifndef __G_BITLOCK_H__
22 #define __G_BITLOCK_H__
24 #include <glib/gtypes.h>
26 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
27 #error "Only <glib.h> can be included directly."
28 #endif
30 G_BEGIN_DECLS
32 GLIB_AVAILABLE_IN_ALL
33 void g_bit_lock (volatile gint *address,
34 gint lock_bit);
35 GLIB_AVAILABLE_IN_ALL
36 gboolean g_bit_trylock (volatile gint *address,
37 gint lock_bit);
38 GLIB_AVAILABLE_IN_ALL
39 void g_bit_unlock (volatile gint *address,
40 gint lock_bit);
42 GLIB_AVAILABLE_IN_ALL
43 void g_pointer_bit_lock (volatile void *address,
44 gint lock_bit);
45 GLIB_AVAILABLE_IN_ALL
46 gboolean g_pointer_bit_trylock (volatile void *address,
47 gint lock_bit);
48 GLIB_AVAILABLE_IN_ALL
49 void g_pointer_bit_unlock (volatile void *address,
50 gint lock_bit);
52 #ifdef __GNUC__
54 #define g_pointer_bit_lock(address, lock_bit) \
55 (G_GNUC_EXTENSION ({ \
56 G_STATIC_ASSERT (sizeof *(address) == sizeof (gpointer)); \
57 g_pointer_bit_lock ((address), (lock_bit)); \
58 }))
60 #define g_pointer_bit_trylock(address, lock_bit) \
61 (G_GNUC_EXTENSION ({ \
62 G_STATIC_ASSERT (sizeof *(address) == sizeof (gpointer)); \
63 g_pointer_bit_trylock ((address), (lock_bit)); \
64 }))
66 #define g_pointer_bit_unlock(address, lock_bit) \
67 (G_GNUC_EXTENSION ({ \
68 G_STATIC_ASSERT (sizeof *(address) == sizeof (gpointer)); \
69 g_pointer_bit_unlock ((address), (lock_bit)); \
70 }))
72 #endif
74 G_END_DECLS
76 #endif /* __G_BITLOCK_H_ */