fixed WIN32 support
[NeonServV5.git] / src / ClientSocket.c
index c49577724393e3de6b1443841072ff8e1ed46105..6d2c34e5d20efe744237d1d6b3fab270a15c7607 100644 (file)
@@ -35,7 +35,7 @@ static pthread_mutex_t synchronized;
 static pthread_mutex_t synchronized_recv;
 
 struct ParseOrder {
-    unsigned long tid;
+    unsigned int tid;
     struct ParseOrder *next;
 };
 struct ParseOrder *parse_order = NULL;
@@ -230,7 +230,7 @@ static int _connect_socket(struct ClientSocket *client) {
     return 1;
 }
 #else
-static int connect_socket(struct ClientSocket *client) {
+static int _connect_socket(struct ClientSocket *client) {
     if((client->flags & SOCKET_FLAG_CONNECTED)) return 1;
     struct hostent *host;
     struct sockaddr_in addr;
@@ -376,7 +376,7 @@ int write_socket(struct ClientSocket *client, char* msg, int len) {
 }
 
 #if HAVE_THREADS
-static void clientsocket_start_of_recv(unsigned long tid) {
+static void clientsocket_start_of_recv(unsigned int tid) {
     SYNCHRONIZE(whohandler_sync);
     struct ParseOrder *entry, *last;
     for(last = parse_order; last; last = last->next) {
@@ -393,7 +393,7 @@ static void clientsocket_start_of_recv(unsigned long tid) {
     DESYNCHRONIZE(whohandler_sync);
 }
 
-static void clientsocket_end_of_recv(unsigned long tid) {
+static void clientsocket_end_of_recv(unsigned int tid) {
     SYNCHRONIZE(whohandler_sync);
     struct ParseOrder *entry, *last = NULL;
     for(entry = parse_order; entry; entry = entry->next) {
@@ -410,7 +410,7 @@ static void clientsocket_end_of_recv(unsigned long tid) {
     DESYNCHRONIZE(whohandler_sync);
 }
 
-int clientsocket_parseorder_top(unsigned long tid) {
+int clientsocket_parseorder_top(unsigned int tid) {
     if(parse_order && parse_order->tid == tid)
         return 1;
     else
@@ -494,7 +494,7 @@ void socket_loop(int timeout_seconds) {
                     sock->bufferpos -= used;
                 }
                 is_synchronized = 0;
-                unsigned long tid = syscall(SYS_gettid);
+                unsigned int tid = (unsigned int) pthread_self_tid();
                 clientsocket_start_of_recv(tid);
                 DESYNCHRONIZE(synchronized_recv);
                 parse_lines(sock, linesbuf, used);