]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/threadengines/threadengine_win32.h
MutexEngine -> MutexFactory, more sensible name
[user/henk/code/inspircd.git] / include / threadengines / threadengine_win32.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
6  * See: http://www.inspircd.org/wiki/index.php/Credits
7  *
8  * This program is free but copyrighted software; see
9  *            the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #ifndef __THREADENGINE_WIN32THREAD__
15 #define __THREADENGINE_WIN32THREAD__
16
17 #include "inspircd_config.h"
18 #include "base.h"
19 #include "threadengine.h"
20
21 class InspIRCd;
22
23 class CoreExport Win32ThreadEngine : public ThreadEngine
24 {
25  public:
26
27         Win32ThreadEngine(InspIRCd* Instance);
28
29         virtual ~Win32ThreadEngine();
30
31         bool Mutex(bool enable);
32
33         void Run();
34
35         static DWORD WINAPI Entry(void* parameter);
36
37         void Create(Thread* thread_to_init);
38
39         void FreeThread(Thread* thread);
40
41         const std::string GetName()
42         {
43                 return "windows-thread";
44         }
45 };
46
47 class CoreExport ThreadEngineFactory : public classbase
48 {
49  public:
50         ThreadEngine* Create(InspIRCd* ServerInstance)
51         {
52                 return new Win32ThreadEngine(ServerInstance);
53         }
54 };
55
56 class CoreExport Win32Mutex : public Mutex
57 {
58  private:
59         CRITICAL_SECTION wutex;
60  public:
61         Win32Mutex(InspIRCd* Instance);
62         virtual void Enable(bool enable);
63         ~Win32Mutex();
64 };
65
66 class CoreExport MutexFactory : public Extensible
67 {
68  protected:
69         InspIRCd* ServerInstance;
70  public:
71         MutexFactory(InspIRCd* Instance);
72         virtual Mutex* CreateMutex();
73 };
74
75 #endif
76