]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/other/ping/ping.cpp
Do not use pthread_kill to stop a thread
[stg.git] / projects / stargazer / plugins / other / ping / ping.cpp
index f4755c230491f73cbec8e7f8c63e22b4ea9bc45f..f0868e1225d21bd5a333094c412e9e4856d75861 100644 (file)
@@ -133,19 +133,6 @@ for (int i = 0; i < 25; i++)
     nanosleep(&ts, NULL);
     }
 
-//after 5 seconds waiting thread still running. now kill it
-if (isRunning)
-    {
-    printfd(__FILE__, "kill PING thread.\n");
-    if (pthread_kill(thread, SIGINT))
-        {
-        errorStr = "Cannot kill PING thread.";
-        printfd(__FILE__, "Cannot kill PING thread.\n");
-        return -1;
-        }
-    printfd(__FILE__, "PING killed\n");
-    }
-
 users->DelNotifierUserAdd(&onAddUserNotifier);
 users->DelNotifierUserDel(&onDelUserNotifier);
 
@@ -157,6 +144,9 @@ while (users_iter != usersList.end())
     ++users_iter;
     }
 
+if (isRunning)
+    return -1;
+
 return 0;
 }
 //-----------------------------------------------------------------------------