]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/threadengines/threadengine_win32.h
Remove UpdateNickHash due to incorrect behavior
[user/henk/code/inspircd.git] / include / threadengines / threadengine_win32.h
index c1f9f2cce08e9bdba47c41a8ad9192d099d141c4..f0f98bbce47edf4c4dc4052b39d1a905cf21bfa8 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
  * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
@@ -17,7 +17,6 @@
 #include "inspircd_config.h"
 #include "base.h"
 
-class InspIRCd;
 class Thread;
 
 /** The ThreadEngine class has the responsibility of initialising
@@ -30,11 +29,11 @@ class Thread;
  * access non-threadsafe code from a Thread, use the Mutex class to wrap
  * access to the code carefully.
  */
-class CoreExport ThreadEngine : public Extensible
+class CoreExport ThreadEngine
 {
  public:
 
-       ThreadEngine(InspIRCd* Instance);
+       ThreadEngine();
 
        virtual ~ThreadEngine();
 
@@ -77,7 +76,7 @@ class CoreExport Mutex
  private:
        CRITICAL_SECTION wutex;
  public:
-       Win32Mutex()
+       Mutex()
        {
                InitializeCriticalSection(&wutex);
        }
@@ -89,11 +88,60 @@ class CoreExport Mutex
        {
                LeaveCriticalSection(&wutex);
        }
-       ~Win32Mutex()
+       ~Mutex()
        {
                DeleteCriticalSection(&wutex);
        }
 };
 
+class ThreadQueueData
+{
+       CRITICAL_SECTION mutex;
+       HANDLE event;
+ public:
+       ThreadQueueData()
+       {
+               InitializeCriticalSection(&mutex);
+               event = CreateEvent(NULL, false, false, NULL);
+       }
+
+       ~ThreadQueueData()
+       {
+               DeleteCriticalSection(&mutex);
+       }
+
+       void Lock()
+       {
+               EnterCriticalSection(&mutex);
+       }
+
+       void Unlock()
+       {
+               LeaveCriticalSection(&mutex);
+       }
+
+       void Wakeup()
+       {
+               PulseEvent(event);
+       }
+
+       void Wait()
+       {
+               LeaveCriticalSection(&mutex);
+               WaitForSingleObject(event, INFINITE);
+               EnterCriticalSection(&mutex);
+       }
+};
+
+class ThreadSignalData
+{
+ public:
+       int connFD;
+       ThreadSignalData()
+       {
+               connFD = -1;
+       }
+};
+
 #endif