1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
|
From 74250cd9c9dfd3ad428e445c095ceac88ba18691 Mon Sep 17 00:00:00 2001
From: Philip Withnall <pwithnall@endlessos.org>
Date: Wed, 11 Nov 2020 18:28:23 +0000
Subject: [PATCH 09/29] gio: Drop unnecessary volatile qualifiers from internal
variables
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
These variables were already (correctly) accessed atomically. The
`volatile` qualifier doesn’t help with that.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: #600
Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719]
---
gio/gdbusinterfaceskeleton.c | 2 +-
gio/gdbusintrospection.h | 14 +++++++-------
gio/gdbusnameowning.c | 4 ++--
gio/gdbusnamewatching.c | 4 ++--
gio/gdbusprivate.c | 10 +++++-----
gio/gnetworking.c | 2 +-
6 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/gio/gdbusinterfaceskeleton.c b/gio/gdbusinterfaceskeleton.c
index 243b4a0a4..76398df36 100644
--- a/gio/gdbusinterfaceskeleton.c
+++ b/gio/gdbusinterfaceskeleton.c
@@ -458,7 +458,7 @@ dbus_interface_interface_init (GDBusInterfaceIface *iface)
typedef struct
{
- volatile gint ref_count;
+ gint ref_count; /* (atomic) */
GDBusInterfaceSkeleton *interface;
GDBusInterfaceMethodCallFunc method_call_func;
GDBusMethodInvocation *invocation;
diff --git a/gio/gdbusintrospection.h b/gio/gdbusintrospection.h
index 14b171055..f2e291787 100644
--- a/gio/gdbusintrospection.h
+++ b/gio/gdbusintrospection.h
@@ -43,7 +43,7 @@ G_BEGIN_DECLS
struct _GDBusAnnotationInfo
{
/*< public >*/
- volatile gint ref_count;
+ gint ref_count; /* (atomic) */
gchar *key;
gchar *value;
GDBusAnnotationInfo **annotations;
@@ -63,7 +63,7 @@ struct _GDBusAnnotationInfo
struct _GDBusArgInfo
{
/*< public >*/
- volatile gint ref_count;
+ gint ref_count; /* (atomic) */
gchar *name;
gchar *signature;
GDBusAnnotationInfo **annotations;
@@ -84,7 +84,7 @@ struct _GDBusArgInfo
struct _GDBusMethodInfo
{
/*< public >*/
- volatile gint ref_count;
+ gint ref_count; /* (atomic) */
gchar *name;
GDBusArgInfo **in_args;
GDBusArgInfo **out_args;
@@ -105,7 +105,7 @@ struct _GDBusMethodInfo
struct _GDBusSignalInfo
{
/*< public >*/
- volatile gint ref_count;
+ gint ref_count; /* (atomic) */
gchar *name;
GDBusArgInfo **args;
GDBusAnnotationInfo **annotations;
@@ -126,7 +126,7 @@ struct _GDBusSignalInfo
struct _GDBusPropertyInfo
{
/*< public >*/
- volatile gint ref_count;
+ gint ref_count; /* (atomic) */
gchar *name;
gchar *signature;
GDBusPropertyInfoFlags flags;
@@ -149,7 +149,7 @@ struct _GDBusPropertyInfo
struct _GDBusInterfaceInfo
{
/*< public >*/
- volatile gint ref_count;
+ gint ref_count; /* (atomic) */
gchar *name;
GDBusMethodInfo **methods;
GDBusSignalInfo **signals;
@@ -172,7 +172,7 @@ struct _GDBusInterfaceInfo
struct _GDBusNodeInfo
{
/*< public >*/
- volatile gint ref_count;
+ gint ref_count; /* (atomic) */
gchar *path;
GDBusInterfaceInfo **interfaces;
GDBusNodeInfo **nodes;
diff --git a/gio/gdbusnameowning.c b/gio/gdbusnameowning.c
index d20e6ffed..1130d6789 100644
--- a/gio/gdbusnameowning.c
+++ b/gio/gdbusnameowning.c
@@ -55,7 +55,7 @@ typedef enum
typedef struct
{
- volatile gint ref_count;
+ gint ref_count; /* (atomic) */
guint id;
GBusNameOwnerFlags flags;
gchar *name;
@@ -73,7 +73,7 @@ typedef struct
guint name_acquired_subscription_id;
guint name_lost_subscription_id;
- volatile gboolean cancelled; /* must hold lock when reading or modifying */
+ gboolean cancelled; /* must hold lock when reading or modifying */
gboolean needs_release;
} Client;
diff --git a/gio/gdbusnamewatching.c b/gio/gdbusnamewatching.c
index bc2a9119e..8d24700c5 100644
--- a/gio/gdbusnamewatching.c
+++ b/gio/gdbusnamewatching.c
@@ -56,7 +56,7 @@ typedef enum
typedef struct
{
- volatile gint ref_count;
+ gint ref_count; /* (atomic) */
guint id;
gchar *name;
GBusNameWatcherFlags flags;
@@ -78,7 +78,7 @@ typedef struct
} Client;
/* Must be accessed atomically. */
-static volatile guint next_global_id = 1;
+static guint next_global_id = 1; /* (atomic) */
/* Must be accessed with @lock held. */
static GHashTable *map_id_to_client = NULL;
diff --git a/gio/gdbusprivate.c b/gio/gdbusprivate.c
index 2551e4791..99b37f3eb 100644
--- a/gio/gdbusprivate.c
+++ b/gio/gdbusprivate.c
@@ -265,7 +265,7 @@ ensure_required_types (void)
typedef struct
{
- volatile gint refcount;
+ gint refcount; /* (atomic) */
GThread *thread;
GMainContext *context;
GMainLoop *loop;
@@ -341,12 +341,12 @@ typedef enum {
struct GDBusWorker
{
- volatile gint ref_count;
+ gint ref_count; /* (atomic) */
SharedThreadData *shared_thread_data;
/* really a boolean, but GLib 2.28 lacks atomic boolean ops */
- volatile gint stopped;
+ gint stopped; /* (atomic) */
/* TODO: frozen (e.g. G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING) currently
* only affects messages received from the other peer (since GDBusServer is the
@@ -1941,11 +1941,11 @@ _g_dbus_debug_print_unlock (void)
void
_g_dbus_initialize (void)
{
- static volatile gsize initialized = 0;
+ static gsize initialized = 0;
if (g_once_init_enter (&initialized))
{
- volatile GQuark g_dbus_error_domain;
+ GQuark g_dbus_error_domain;
const gchar *debug;
g_dbus_error_domain = G_DBUS_ERROR;
diff --git a/gio/gnetworking.c b/gio/gnetworking.c
index 05507fe70..7bc6d73c4 100644
--- a/gio/gnetworking.c
+++ b/gio/gnetworking.c
@@ -61,7 +61,7 @@ void
g_networking_init (void)
{
#ifdef G_OS_WIN32
- static volatile gsize inited = 0;
+ static gsize inited = 0;
if (g_once_init_enter (&inited))
{
--
2.30.1
|