kqueue: Fix unlocked access to shared variable

And drop the `volatile` qualifier because it doesn’t help.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #600
This commit is contained in:
Philip Withnall 2020-11-11 18:29:26 +00:00
parent 74250cd9c9
commit e4e88688a0

View File

@ -34,7 +34,7 @@ static gboolean km_debug_enabled = FALSE;
static GSList *missing_subs_list = NULL; static GSList *missing_subs_list = NULL;
G_LOCK_DEFINE_STATIC (missing_lock); G_LOCK_DEFINE_STATIC (missing_lock);
static volatile gboolean scan_missing_running = FALSE; static gboolean scan_missing_running = FALSE; /* must be accessed under @missing_lock */
static gboolean static gboolean
@ -62,7 +62,6 @@ _km_add_missing (kqueue_sub *sub)
KM_W ("adding %s to missing list\n", sub->filename); KM_W ("adding %s to missing list\n", sub->filename);
missing_subs_list = g_slist_prepend (missing_subs_list, sub); missing_subs_list = g_slist_prepend (missing_subs_list, sub);
G_UNLOCK (missing_lock);
if (!scan_missing_running) if (!scan_missing_running)
{ {
@ -73,6 +72,8 @@ _km_add_missing (kqueue_sub *sub)
g_source_attach (source, GLIB_PRIVATE_CALL (g_get_worker_context) ()); g_source_attach (source, GLIB_PRIVATE_CALL (g_get_worker_context) ());
g_source_unref (source); g_source_unref (source);
} }
G_UNLOCK (missing_lock);
} }
/** /**