diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-09-06 14:41:44 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-09-06 14:41:44 +0000 |
commit | 43240de39d64ccd1cc886342002b14f4147a2efc (patch) | |
tree | 8ab1b9c8f0fe1e1bd2acceee09aaf65c971cc8d4 /include/threadengine.h | |
parent | 66917d76f503114aa891102151595ab51e0be686 (diff) |
Make ThreadEngine::Mutex() protected too, make the user use Lock() and Unlock()
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10418 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include/threadengine.h')
-rw-r--r-- | include/threadengine.h | 28 |
1 files changed, 19 insertions, 9 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. */ |