added experimental multi thread support
[NeonServV5.git] / src / HandleInfoHandler.c
index c194935eab2c4906e7de94904e8e626a58bd4137..99d19658b73c33d6b24abb729988eecbc44cc746 100644 (file)
@@ -18,6 +18,7 @@
 #include "HandleInfoHandler.h"
 #include "ClientSocket.h"
 #include "UserNode.h"
+#include "ChanNode.h"
 #include "IRCEvents.h"
 #include "tools.h"
 
@@ -40,17 +41,20 @@ static struct HandleInfoQueueEntry* addHandleInfoQueueEntry(struct ClientSocket
         perror("malloc() failed");
         return NULL;
     }
+    SYNCHRONIZE(cache_sync);
     entry->next = NULL;
     if(client->handleinfo_last)
         client->handleinfo_last->next = entry;
     else
         client->handleinfo_first = entry;
     client->handleinfo_last = entry;
+    DESYNCHRONIZE(cache_sync);
     return entry;
 }
 
 static struct HandleInfoQueueEntry* getNextHandleInfoQueueEntry(struct ClientSocket *client, int freeEntry) {
     if(!client->handleinfo_first) return NULL;
+    SYNCHRONIZE(cache_sync);
     struct HandleInfoQueueEntry *entry = client->handleinfo_first;
     if(freeEntry) {
         client->handleinfo_first = entry->next;
@@ -58,11 +62,13 @@ static struct HandleInfoQueueEntry* getNextHandleInfoQueueEntry(struct ClientSoc
             client->handleinfo_last = NULL;
         }
     }
+    DESYNCHRONIZE(cache_sync);
     return entry;
 }
 
 void clear_handleinfoqueue(struct ClientSocket *client) {
     if(!client->handleinfo_first) return;
+    SYNCHRONIZE(cache_sync);
     struct HandleInfoQueueEntry *entry, *next;
     for(entry = client->handleinfo_first; entry; entry = next) {
         next = entry->next;
@@ -70,6 +76,7 @@ void clear_handleinfoqueue(struct ClientSocket *client) {
     }
     client->handleinfo_last = NULL;
     client->handleinfo_first = NULL;
+    DESYNCHRONIZE(cache_sync);
 }
 
 void lookup_authname(char *auth, authlookup_callback_t callback, void *data) {