[common] Let edge wait listener thread to be started. sandbox/sangjung/tizen_7_backport accepted/tizen/7.0/unified/20240426.015347 accepted/tizen/8.0/unified/20240424.115823 accepted/tizen/unified/20240425.114316 accepted/tizen/unified/toolchain/20240427.045726 accepted/tizen/unified/x/20240426.050336
authorYongjoo Ahn <yongjoo1.ahn@samsung.com>
Tue, 16 Apr 2024 08:59:59 +0000 (17:59 +0900)
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>
Wed, 17 Apr 2024 03:06:53 +0000 (12:06 +0900)
- Let the edge wait listener_thread to be properly started.
- This fix occasional hangs when nns_edge_release_handle called.

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
src/libnnstreamer-edge/nnstreamer-edge-internal.c

index c1b892bc21b732d5c730f11ccdc3fbb44e8e142a..7760dd2a90865eaed87745d6bfd63ff58d308a72 100644 (file)
@@ -1165,7 +1165,11 @@ _nns_edge_socket_listener_thread (void *thread_data)
 {
   nns_edge_handle_s *eh = (nns_edge_handle_s *) thread_data;
 
+  nns_edge_lock (eh);
   eh->listening = true;
+  nns_edge_cond_signal (eh);
+  nns_edge_unlock (eh);
+
   while (eh->listening) {
     struct pollfd poll_fd;
 
@@ -1235,6 +1239,9 @@ _nns_edge_create_socket_listener (nns_edge_handle_s * eh)
     goto error;
   }
 
+  /* Wait for the listener thread to be started */
+  nns_edge_cond_wait (eh);
+
   done = true;
 
 error: