#include <sys/types.h>
#include <sys/socket.h>
-#include <unistd.h> // usleep, close
+#include <unistd.h> // close
#include <csignal>
#include <cstdlib>
//5 seconds to thread stops itself
for (int i = 0; i < 25 && isRunningRun; i++)
{
- usleep(200000);
+ struct timespec ts = {0, 200000000};
+ nanosleep(&ts, NULL);
}
//after 5 seconds waiting thread still running. now killing it
return -1;
}
for (int i = 0; i < 25 && isRunningRun; ++i)
- usleep(200000);
+ {
+ struct timespec ts = {0, 200000000};
+ nanosleep(&ts, NULL);
+ }
if (isRunningRun)
{
printfd(__FILE__, "Failed to stop recv thread\n");
//5 seconds to thread stops itself
for (int i = 0; i < 25 && isRunningRunTimeouter; i++)
{
- usleep(200000);
+ struct timespec ts = {0, 200000000};
+ nanosleep(&ts, NULL);
}
//after 5 seconds waiting thread still running. now killing it
return -1;
}
for (int i = 0; i < 25 && isRunningRunTimeouter; ++i)
- usleep(200000);
+ {
+ struct timespec ts = {0, 200000000};
+ nanosleep(&ts, NULL);
+ }
if (isRunningRunTimeouter)
{
printfd(__FILE__, "Failed to stop timeouter thread\n");
//-----------------------------------------------------------------------------
void * AUTH_IA::Run(void * d)
{
+sigset_t signalSet;
+sigfillset(&signalSet);
+pthread_sigmask(SIG_BLOCK, &signalSet, NULL);
+
AUTH_IA * ia = static_cast<AUTH_IA *>(d);
ia->isRunningRun = true;
//-----------------------------------------------------------------------------
void * AUTH_IA::RunTimeouter(void * d)
{
+sigset_t signalSet;
+sigfillset(&signalSet);
+pthread_sigmask(SIG_BLOCK, &signalSet, NULL);
+
AUTH_IA * ia = static_cast<AUTH_IA *>(d);
ia->isRunningRunTimeouter = true;
string monFile = ia->stgSettings->GetMonitorDir() + "/inetaccess_t";
while (ia->nonstop)
{
- usleep(20000);
+ struct timespec ts = {0, 20000000};
+ nanosleep(&ts, NULL);
ia->Timeouter();
// TODO change counter to timer and MONITOR_TIME_DELAY_SEC
if (++a % (50 * 60) == 0 && ia->stgSettings->GetMonitoring())