13
0

Prefer atomic dec_and_test (instead of atomic get+set)

This commit is contained in:
Robin Gareus 2022-06-14 18:19:52 +02:00
parent 2e2a4be3b2
commit b95bb0bdac
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -71,7 +71,7 @@ PresentationInfo::unsuspend_change_signal ()
{ {
Glib::Threads::Mutex::Lock lm (static_signal_lock); Glib::Threads::Mutex::Lock lm (static_signal_lock);
if (g_atomic_int_get (&_change_signal_suspended) == 1) { if (g_atomic_int_dec_and_test (&_change_signal_suspended)) {
/* atomically grab currently pending flags */ /* atomically grab currently pending flags */
@ -92,8 +92,6 @@ PresentationInfo::unsuspend_change_signal ()
lm.acquire (); lm.acquire ();
} }
} }
g_atomic_int_add (&_change_signal_suspended, -1);
} }
void void