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