handler_ref and handler_unref_R are always called with the signal
lock held. This is obvious for handler_unref_R as it even sometimes
drops this lock, and can be verified quickly for handler_ref by looking
at all call sites.
This improves the performace about 6% on the emit-handled and the
emit-handled-generic tests.
https://bugzilla.gnome.org/show_bug.cgi?id=694253
{
g_return_if_fail (handler->ref_count > 0);
- g_atomic_int_inc ((int *)&handler->ref_count);
+ handler->ref_count++;
}
static inline void
gpointer instance,
Handler *handler)
{
- gboolean is_zero;
-
g_return_if_fail (handler->ref_count > 0);
-
- is_zero = g_atomic_int_dec_and_test ((int *)&handler->ref_count);
- if (G_UNLIKELY (is_zero))
+ handler->ref_count--;
+
+ if (G_UNLIKELY (handler->ref_count == 0))
{
HandlerList *hlist = NULL;