X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fthread.cpp;h=841cc3f48e8111a894dc9151268fce3858dcd4f0;hb=5763dd6e8089c97699cbcbd221afb7fe1841bcdd;hp=721e8cfef51f2ff772c304ff9ece65554c3f033a;hpb=a4596d1c2f627e4568eb6c01d81b6e45f488715a;p=libs%2Fcore.git diff --git a/source/core/thread.cpp b/source/core/thread.cpp index 721e8cf..841cc3f 100644 --- a/source/core/thread.cpp +++ b/source/core/thread.cpp @@ -7,43 +7,42 @@ using namespace std; namespace Msp { Thread::Thread(const string &name): - priv_(new Private), - name_(name), - state_(PENDING) + _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) + if(_state>=RUNNING) throw logic_error("already launched"); platform_launch(); - state_ = RUNNING; + _state = RUNNING; } ThreadReturn THREAD_CALL Thread::Private::main_wrapper(void *arg) @@ -51,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; }