[wing/join-thread] wingservice: join thread when notifying the stop




commit 168e9048a5ede09e15c1cf61761c3310408f4c4a
Author: Ignacio Casal Quinteiro <qignacio amazon com>
Date:   Fri Apr 1 11:03:42 2022 +0200

    wingservice: join thread when notifying the stop
    
    Otherwise the thread might be around when exitting the service

 wing/wingservice.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/wing/wingservice.c b/wing/wingservice.c
index 15c87b5..4c9758d 100644
--- a/wing/wingservice.c
+++ b/wing/wingservice.c
@@ -762,9 +762,19 @@ wing_service_register (WingService  *service,
 void
 wing_service_notify_stopped (WingService *service)
 {
+  WingServicePrivate *priv;
+
   g_return_if_fail (WING_IS_SERVICE (service));
 
   set_service_status (service, SERVICE_STOPPED);
+
+  priv = wing_service_get_instance_private (service);
+
+  if (priv->thread != NULL)
+    {
+      g_thread_join (priv->thread);
+      priv->thread = NULL;
+    }
 }
 
 static gint


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]