summaryrefslogtreecommitdiff
path: root/gio
diff options
context:
space:
mode:
authorPhilip Withnall <withnall@endlessm.com>2017-02-05 16:34:54 +0100
committerPhilip Withnall <withnall@endlessm.com>2017-03-23 15:00:19 +0000
commit4091b2d19e165ab9857ea4cd5ea296718540a4f8 (patch)
tree5934b2e9b0f2b522a3f2cc7582f1aced593c6c14 /gio
parent553329358c9e6845d567bb7367ae404c21d22dea (diff)
downloadglib-4091b2d19e165ab9857ea4cd5ea296718540a4f8.tar.gz
gio: Drop redundant g_source_is_destroyed() calls
These calls cause race warnings from tsan, but are not a thread safety problem, because we can only ever observe single bit changes: all modifications to the GSource.flags field are done with a lock held; all reads are of independent fields, so no intermediate state can ever be observed. This assumes that a non-atomic read will consistently give us an old value or a new value. In any case, these g_source_is_destroyed() calls can happen from any thread, and the state could be changed from another thread immediately after the call returns; so the checks are pointless. In addition, calling g_source_set_ready_time() or g_source_destroy() on a destroyed source is not a problem. https://bugzilla.gnome.org/show_bug.cgi?id=778049
Diffstat (limited to 'gio')
-rw-r--r--gio/gcancellable.c3
-rw-r--r--gio/gsubprocess.c3
2 files changed, 2 insertions, 4 deletions
diff --git a/gio/gcancellable.c b/gio/gcancellable.c
index 2d098367f..bda7910ec 100644
--- a/gio/gcancellable.c
+++ b/gio/gcancellable.c
@@ -650,8 +650,7 @@ cancellable_source_cancelled (GCancellable *cancellable,
{
GSource *source = user_data;
- if (!g_source_is_destroyed (source))
- g_source_set_ready_time (source, 0);
+ g_source_set_ready_time (source, 0);
}
static gboolean
diff --git a/gio/gsubprocess.c b/gio/gsubprocess.c
index 5fd535575..bec991c41 100644
--- a/gio/gsubprocess.c
+++ b/gio/gsubprocess.c
@@ -1499,8 +1499,7 @@ g_subprocess_communicate_state_free (gpointer data)
if (state->cancellable_source)
{
- if (!g_source_is_destroyed (state->cancellable_source))
- g_source_destroy (state->cancellable_source);
+ g_source_destroy (state->cancellable_source);
g_source_unref (state->cancellable_source);
}