git.stg.codes
/
stg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add missing header in cap_ipq
[stg.git]
/
stglibs
/
ia.lib
/
ia.cpp
diff --git
a/stglibs/ia.lib/ia.cpp
b/stglibs/ia.lib/ia.cpp
index 9883dbbb8d276dbc2cb30db284b1a2c257f6564f..dc8d553e4c3f5514716ba0f1d5d395f9b29b9a17 100644
(file)
--- a/
stglibs/ia.lib/ia.cpp
+++ b/
stglibs/ia.lib/ia.cpp
@@
-29,25
+29,26
@@
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
+#ifdef WIN32
+#include <winsock2.h>
+#include <windows.h>
+#include <winbase.h>
+#include <winnt.h>
+#else
+#include <fcntl.h>
+#include <netdb.h>
+#include <arpa/inet.h>
+#include <unistd.h>
+#include <csignal>
+#endif
+
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
-#ifdef WIN32
- #include <winsock2.h>
- #include <windows.h>
- #include <winbase.h>
- #include <winnt.h>
-#else
- #include <fcntl.h>
- #include <netdb.h>
- #include <arpa/inet.h>
- #include <unistd.h>
-#endif
-
#include "stg/common.h"
#include "stg/common.h"
-#include "ia.h"
+#include "
stg/
ia.h"
#define IA_NONE (0)
#define IA_CONNECT (1)
#define IA_NONE (0)
#define IA_CONNECT (1)
@@
-61,15
+62,25
@@
//---------------------------------------------------------------------------
#ifndef WIN32
#include <sys/time.h>
//---------------------------------------------------------------------------
#ifndef WIN32
#include <sys/time.h>
+void Sleep(int ms)
+{
+long long res = ms * 1000000;
+struct timespec ts = {res / 1000000000, res % 1000000000};
+nanosleep(&ts, NULL);
+}
+//---------------------------------------------------------------------------
void * RunL(void * data)
{
void * RunL(void * data)
{
+sigset_t signalSet;
+sigfillset(&signalSet);
+pthread_sigmask(SIG_BLOCK, &signalSet, NULL);
IA_CLIENT_PROT * c = (IA_CLIENT_PROT *)data;
static int a = 0;
if (a == 0)
{
IA_CLIENT_PROT * c = (IA_CLIENT_PROT *)data;
static int a = 0;
if (a == 0)
{
-
usleep(5000
0);
+
Sleep(5
0);
a = 1;
}
a = 1;
}
@@
-80,11
+91,6
@@
while (c->GetNonstop())
return NULL;
}
//---------------------------------------------------------------------------
return NULL;
}
//---------------------------------------------------------------------------
-void Sleep(int ms)
-{
-usleep(ms * 1000);
-}
-//---------------------------------------------------------------------------
long GetTickCount()
{
struct timeval tv;
long GetTickCount()
{
struct timeval tv;