From: Hwankyu Jhun Date: Wed, 6 Dec 2023 04:49:56 +0000 (+0900) Subject: Add locking and unlocking mutex X-Git-Tag: accepted/tizen/6.5/unified/20231207.042859~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dbe5cdadfb7262728465d234a322eef2e3557ac2;p=platform%2Fcore%2Fappfw%2Ftidl.git Add locking and unlocking mutex It is problematic if a callback invoke event is delivered to the main thread while calling callback dispose() in the sub-thread. To fix the thread safe issue, this patch adds locking & unlocking mutex. Change-Id: I4cd8d3a47d40fadc773775f9c6b6aa7a4000ab6e Signed-off-by: Hwankyu Jhun --- diff --git a/idlc/gen/c_proxy_body_gen_cb.h b/idlc/gen/c_proxy_body_gen_cb.h index 5142739..238522d 100644 --- a/idlc/gen/c_proxy_body_gen_cb.h +++ b/idlc/gen/c_proxy_body_gen_cb.h @@ -278,15 +278,18 @@ int ___dispose(__h proxy, _mutex); found = g_list_find(proxy->delegates, h); if (found == nullptr) { _E("Invalid parameter"); + g_rec_mutex_unlock(&proxy->mutex); return RPC_PORT_ERROR_INVALID_PARAMETER; } proxy->delegates = g_list_remove_link(proxy->delegates, found); ___destroy(h); g_list_free(found); + g_rec_mutex_unlock(&proxy->mutex); return RPC_PORT_ERROR_NONE; } @@ -561,7 +564,9 @@ static void ____received(const char *endpoint, const char *port_na return; } + g_rec_mutex_lock(&h->mutex); ____process_received_event(&h->delegates, parcel); + g_rec_mutex_unlock(&h->mutex); rpc_port_parcel_destroy(parcel); }