X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fcore%2Fthread.cpp;h=e860d6758f9e048f070b67855e7d7810456e7c48;hp=e03dcb86062f09af9368471cbb21f947aa751cf3;hb=HEAD;hpb=122846f0881673770d88eff7d925ecf25c01b62e diff --git a/source/core/thread.cpp b/source/core/thread.cpp index e03dcb8..ad78d94 100644 --- a/source/core/thread.cpp +++ b/source/core/thread.cpp @@ -1,4 +1,4 @@ -#include +#include "except.h" #include "thread.h" #include "thread_private.h" @@ -7,42 +7,42 @@ using namespace std; namespace Msp { Thread::Thread(const string &name): - priv_(new Private), - name_(name) + _priv(new Private), + _name(name) { } Thread::~Thread() { kill(); join(); - delete priv_; + delete _priv; } void Thread::join() { - if(state_>=JOINED) + if(_state>=JOINED) return; platform_join(); - state_ = JOINED; + _state = JOINED; } void Thread::kill() { - if(state_!=RUNNING) + if(_state!=RUNNING) return; platform_kill(); - state_ = KILLED; + _state = KILLED; } void Thread::launch() { - if(state_>=RUNNING) - throw logic_error("already launched"); + if(_state>=RUNNING) + throw already_called("Thread::launch"); platform_launch(); - state_ = RUNNING; + _state = RUNNING; } ThreadReturn THREAD_CALL Thread::Private::main_wrapper(void *arg) @@ -50,7 +50,7 @@ ThreadReturn THREAD_CALL Thread::Private::main_wrapper(void *arg) Thread *thread = reinterpret_cast(arg); thread->platform_setname(); thread->main(); - thread->state_ = FINISHED; + thread->_state = FINISHED; return 0; }