From: Daniel Wagner Date: Thu, 11 Aug 2011 14:56:17 +0000 (+0200) Subject: service: Extend debug message for session refcounting X-Git-Tag: 0.77~42 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=db53a66b3b24ca96f9ee49ada9468a5c34939cfe;p=platform%2Fupstream%2Fconnman.git service: Extend debug message for session refcounting --- diff --git a/src/service.c b/src/service.c index 24b466e..0f26379 100644 --- a/src/service.c +++ b/src/service.c @@ -1628,23 +1628,21 @@ GSequence *__connman_service_get_list(struct connman_session *session, void __connman_service_session_inc(struct connman_service *service) { - DBG("service %p", service); + DBG("service %p ref count %d", service, + g_atomic_int_get(&service->session_usage_count) + 1); g_atomic_int_inc(&service->session_usage_count); } connman_bool_t __connman_service_session_dec(struct connman_service *service) { - connman_bool_t in_use; - - if (g_atomic_int_dec_and_test(&service->session_usage_count) == TRUE) - in_use = FALSE; - else - in_use = TRUE; + DBG("service %p ref count %d", service, + g_atomic_int_get(&service->session_usage_count) - 1); - DBG("service %p last %d", service, in_use); + if (g_atomic_int_dec_and_test(&service->session_usage_count) == FALSE) + return FALSE; - return in_use; + return TRUE; } static void append_properties(DBusMessageIter *dict, dbus_bool_t limited,