1.1 --- a/core/Database.h Tue Aug 20 23:59:11 2013 -0700
1.2 +++ b/core/Database.h Wed Aug 21 00:01:28 2013 -0700
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * vim: set ts=4 :
1.6 + * vim: set ts=4 sw=4 tw=99 noet :
1.7 * =============================================================================
1.8 * SourceMod
1.9 * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
1.10 @@ -41,6 +41,7 @@
1.11 #include "sm_memtable.h"
1.12 #include <IThreader.h>
1.13 #include <IPluginSys.h>
1.14 +#include <ke_thread_utils.h>
1.15 #include "sm_simple_prioqueue.h"
1.16
1.17 using namespace SourceHook;
1.18 @@ -65,9 +66,8 @@
1.19 public SMGlobalClass,
1.20 public IHandleTypeDispatch,
1.21 public ITextListener_SMC,
1.22 - public IThread,
1.23 - public IThreadWorkerCallbacks,
1.24 - public IPluginsListener
1.25 + public IPluginsListener,
1.26 + public ke::IRunnable
1.27 {
1.28 public:
1.29 DBManager();
1.30 @@ -98,12 +98,9 @@
1.31 SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value);
1.32 SMCResult ReadSMC_LeavingSection(const SMCStates *states);
1.33 void ReadSMC_ParseEnd(bool halted, bool failed);
1.34 -public: //IThread
1.35 - void RunThread(IThreadHandle *pThread);
1.36 - void OnTerminate(IThreadHandle *pThread, bool cancel);
1.37 -public: //IThreadWorkerCallbacks
1.38 - void OnWorkerStart(IThreadWorker *pWorker);
1.39 - void OnWorkerStop(IThreadWorker *pWorker);
1.40 +public: //ke::IRunnable
1.41 + void Run();
1.42 + void ThreadMain();
1.43 public: //IPluginsListener
1.44 void OnPluginUnloaded(IPlugin *plugin);
1.45 public:
1.46 @@ -129,10 +126,11 @@
1.47 PrioQueue<IDBThreadOperation *> m_OpQueue;
1.48 Queue<IDBThreadOperation *> m_ThinkQueue;
1.49 CVector<bool> m_drSafety; /* which drivers are safe? */
1.50 - IThreadWorker *m_pWorker; /* Worker thread object */
1.51 - IMutex *m_pConfigLock; /* Configuration lock */
1.52 - IMutex *m_pQueueLock; /* Queue safety lock */
1.53 - IMutex *m_pThinkLock; /* Think-queue lock */
1.54 + ke::AutoPtr<ke::Thread> m_Worker;
1.55 + ke::ConditionVariable m_QueueEvent;
1.56 + ke::Mutex m_ConfigLock;
1.57 + ke::Mutex m_ThinkLock;
1.58 + bool m_Terminate;
1.59
1.60 List<ConfDbInfo *> m_confs;
1.61 HandleType_t m_DriverType;