]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspircd.cpp
Roll back to 1.2, not 4.0 module ver
[user/henk/code/inspircd.git] / src / inspircd.cpp
index de725d0e1601f14bfafd5325a3e4edebab1d69e5..04a0907a7770bc53e97285dc94588551916e08b5 100644 (file)
@@ -499,10 +499,7 @@ InspIRCd::InspIRCd(int argc, char** argv)
         * For an explanation as to exactly how this works, and why it works this way, see GetUID().
         *   -- w00t
         */
-       if (*Config->sid)
-       {
-       }
-       else
+       if (!*Config->sid)
        {
                // Generate one
                size_t sid = 0;
@@ -636,11 +633,26 @@ int InspIRCd::Run()
                static char window_title[100];
 #endif
 
+               /* Check if there is a config thread which has finished executing but has not yet been freed */
                if (this->ConfigThread && this->ConfigThread->GetExitFlag())
                {
                        /* Rehash has completed */
                        this->Logs->Log("CONFIG",DEBUG,"Detected ConfigThread exiting, tidying up...");
+
+                       /* IMPORTANT: This delete may hang if you fuck up your thread syncronization.
+                        * It will hang waiting for the ConfigThread to 'join' to avoid race conditons,
+                        * until the other thread is completed.
+                        */
                        delete ConfigThread;
+                       ConfigThread = NULL;
+
+                       /* These are currently not known to be threadsafe, so they are executed outside
+                        * of the thread. It would be pretty simple to move them to the thread Run method
+                        * once they are known threadsafe with all the correct mutexes in place.
+                        *
+                        * XXX: The order of these is IMPORTANT, do not reorder them without testing
+                        * thoroughly!!!
+                        */
                        this->XLines->CheckELines();
                        this->XLines->ApplyLines();
                        this->Res->Rehash();
@@ -665,7 +677,7 @@ int InspIRCd::Run()
                {
                        if (TIME < OLDTIME)
                        {
-                               SNO->WriteToSnoMask('A', "\002EH?!\002 -- Time is flowing BACKWARDS in this dimension! Clock drifted backwards %d secs.",abs(OLDTIME-TIME));
+                               SNO->WriteToSnoMask('A', "\002EH?!\002 -- Time is flowing BACKWARDS in this dimension! Clock drifted backwards %d secs.",OLDTIME-TIME);
                        }
 
                        if ((TIME % 3600) == 0)