summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/threadengine.h28
-rw-r--r--include/threadengines/threadengine_pthread.h6
-rw-r--r--include/threadengines/threadengine_win32.h6
3 files changed, 27 insertions, 13 deletions
diff --git a/include/threadengine.h b/include/threadengine.h
index d41ad98d3..a8b66ad98 100644
--- a/include/threadengine.h
+++ b/include/threadengine.h
@@ -40,10 +40,21 @@ class CoreExport ThreadEngine : public Extensible
/** Creator instance
*/
InspIRCd* ServerInstance;
+
/** New Thread being created.
*/
Thread* NewThread;
+ /** Enable or disable system-wide mutex for threading.
+ * Remember that if you toggle the mutex you MUST UNSET
+ * IT LATER otherwise the program will DEADLOCK!
+ * It is recommended that you AVOID USE OF THIS METHOD
+ * and use your own Mutex class, this function is mainly
+ * reserved for use by the core and by the Thread engine
+ * itself.
+ * @param enable True to lock the mutex.
+ */
+ virtual bool Mutex(bool enable) = 0;
public:
/** Constructor.
@@ -55,16 +66,15 @@ class CoreExport ThreadEngine : public Extensible
*/
virtual ~ThreadEngine();
- /** Enable or disable system-wide mutex for threading.
- * Remember that if you toggle the mutex you MUST UNSET
- * IT LATER otherwise the program will DEADLOCK!
- * It is recommended that you AVOID USE OF THIS METHOD
- * and use your own Mutex class, this function is mainly
- * reserved for use by the core and by the Thread engine
- * itself.
- * @param enable True to lock the mutex.
+ /** Lock the system wide mutex. See the documentation for
+ * ThreadEngine::Mutex().
+ */
+ void Lock() { this->Mutex(true); }
+
+ /** Unlock the system wide mutex. See the documentation for
+ * ThreadEngine::Mutex()
*/
- virtual bool Mutex(bool enable) = 0;
+ void Unlock() { this->Mutex(false); }
/** Run the newly created thread.
*/
diff --git a/include/threadengines/threadengine_pthread.h b/include/threadengines/threadengine_pthread.h
index 76548c252..bd07f0ea9 100644
--- a/include/threadengines/threadengine_pthread.h
+++ b/include/threadengines/threadengine_pthread.h
@@ -23,14 +23,16 @@ class InspIRCd;
class CoreExport PThreadEngine : public ThreadEngine
{
+ private:
+
+ bool Mutex(bool enable);
+
public:
PThreadEngine(InspIRCd* Instance);
virtual ~PThreadEngine();
- bool Mutex(bool enable);
-
void Run();
static void* Entry(void* parameter);
diff --git a/include/threadengines/threadengine_win32.h b/include/threadengines/threadengine_win32.h
index 9179d1fcf..1915ecc7b 100644
--- a/include/threadengines/threadengine_win32.h
+++ b/include/threadengines/threadengine_win32.h
@@ -22,14 +22,16 @@ class InspIRCd;
class CoreExport Win32ThreadEngine : public ThreadEngine
{
+ protected:
+
+ bool Mutex(bool enable);
+
public:
Win32ThreadEngine(InspIRCd* Instance);
virtual ~Win32ThreadEngine();
- bool Mutex(bool enable);
-
void Run();
static DWORD WINAPI Entry(void* parameter);