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);
++users_iter;
}
+if (isRunning)
+ return -1;
+
return 0;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void * PING::Run(void * d)
{
-PING * ping = (PING *)d;
+sigset_t signalSet;
+sigfillset(&signalSet);
+pthread_sigmask(SIG_BLOCK, &signalSet, NULL);
+
+PING * ping = static_cast<PING *>(d);
ping->isRunning = true;
long delay = (10000000 * ping->pingSettings.GetPingDelay()) / 3 + 50000000;