Fix C Generator for critical section 85/309085/1
authorHwankyu Jhun <h.jhun@samsung.com>
Thu, 4 Apr 2024 11:25:15 +0000 (20:25 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Thu, 4 Apr 2024 11:25:15 +0000 (20:25 +0900)
This patch adjusts locking and unlocking mutex for proxy apps.

Change-Id: Icf4a2ca40dc77fdaf915eb4a566fb5a07790c8d9
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
idlc/gen/c_proxy_body_gen.cc
idlc/gen/c_proxy_body_gen_cb.h

index 7c775f57a304d10e8d15b91e4d5cd6e245df6b52..86567619dace1d0c7be7e5e6a96b541d8607464b 100644 (file)
@@ -513,6 +513,7 @@ std::string CProxyBodyGen::GetMethodReadString(const Interface& inf,
   const char setter[] = "$$($$, $$);\n";
   std::string str;
   if (decl.GetMethodType() != Declaration::MethodType::SYNC) {
+    str += "g_rec_mutex_unlock(&h->mutex);" + NLine(1);
     str += "set_last_result(r);" + NLine(1);
     return str;
   }
index dc3e7814b03429bd0d2389f0e7eca64ce9cf33c1..04fb69626b20dbcc6ef5137c69a516a94d7cffc3 100644 (file)
@@ -351,6 +351,7 @@ $$
         return$$;
     }
 $$
+    g_rec_mutex_lock(&h->mutex);
     rpc_port_parcel_create(&parcel);
     rpc_port_parcel_write_int32(parcel, ##_METHOD_$$);
 $$
@@ -520,7 +521,6 @@ do {
 
 const char CB_RECEIVE_BLOCK[] =
 R"__c_cb(
-g_rec_mutex_lock(&h->mutex);
 do {
     rpc_port_parcel_h parcel_received;
 $$