diff options
author | chai <chaifix@163.com> | 2018-10-20 16:18:11 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-10-20 16:18:11 +0800 |
commit | cf68d9f46da1cf20503a7d738da1f43de916004d (patch) | |
tree | 5577e44d926deadb15ef5ca145e705eae14636fe /src/lua/modules/thread/Thread.h | |
parent | e9410bd371fc68169c57d2c52382948a0b083da4 (diff) |
*格式化代码
Diffstat (limited to 'src/lua/modules/thread/Thread.h')
-rw-r--r-- | src/lua/modules/thread/Thread.h | 174 |
1 files changed, 87 insertions, 87 deletions
diff --git a/src/lua/modules/thread/Thread.h b/src/lua/modules/thread/Thread.h index 9c375f0..2ccadc2 100644 --- a/src/lua/modules/thread/Thread.h +++ b/src/lua/modules/thread/Thread.h @@ -1,94 +1,94 @@ #include "libjin/jin.h" #include "lua/common/common.h" -namespace jin +namespace JinEngine { -namespace lua -{ -namespace thread -{ - - class Thread + namespace Lua { - public: - typedef JinEngine::MultiThread::Thread::Variant Variant; - typedef JinEngine::MultiThread::Thread::ThreadRunner ThreadRunner; - - Thread(std::string _name, std::string _code, ThreadRunner runner) - : name(_name) - , code(_code) - { - thread = new JinEngine::MultiThread::Thread(_name, runner); - } - - ~Thread() - { - delete thread; - } - - bool start(void* p) - { - return thread->start(p); - } - - void wait() - { - thread->wait(); - } - - void send(int slot, const Variant& value) - { - thread->send(slot, value); - } - - bool receive(int slot) - { - return thread->receive(slot); - } - - Variant fetch(int slot) + namespace thread { - return thread->fetch(slot); - } - - Variant demand(int slot) - { - return thread->demand(slot); - } - - void remove(int slot) - { - thread->remove(slot); - } - - const char* getName() - { - return name.c_str(); - } - - bool isRunning() - { - return thread->isRunning(); - } - - void lock() - { - thread->lock(); - } - - void unlock() - { - thread->unlock(); - } - - const std::string name; - const std::string code; - - private: - JinEngine::MultiThread::Thread* thread; - - }; -} // thread -} // lua -} // jin
\ No newline at end of file + class Thread + { + public: + typedef JinEngine::MultiThread::Thread::Variant Variant; + typedef JinEngine::MultiThread::Thread::ThreadRunner ThreadRunner; + + Thread(std::string _name, std::string _code, ThreadRunner runner) + : name(_name) + , code(_code) + { + thread = new JinEngine::MultiThread::Thread(_name, runner); + } + + ~Thread() + { + delete thread; + } + + bool start(void* p) + { + return thread->start(p); + } + + void wait() + { + thread->wait(); + } + + void send(int slot, const Variant& value) + { + thread->send(slot, value); + } + + bool receive(int slot) + { + return thread->receive(slot); + } + + Variant fetch(int slot) + { + return thread->fetch(slot); + } + + Variant demand(int slot) + { + return thread->demand(slot); + } + + void remove(int slot) + { + thread->remove(slot); + } + + const char* getName() + { + return name.c_str(); + } + + bool isRunning() + { + return thread->isRunning(); + } + + void lock() + { + thread->lock(); + } + + void unlock() + { + thread->unlock(); + } + + const std::string name; + const std::string code; + + private: + JinEngine::MultiThread::Thread* thread; + + }; + + } // thread + } // Lua +} // JinEngine
\ No newline at end of file |