fix thread namespace

Origin commit data
------------------
Branch: master
Commit: 3ef2eeb8aa
Author: smogm <smogm@vh0st.me>
Date: 2015-01-12 (Mon, 12 Jan 2015)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
smogm
2015-01-12 16:38:28 +01:00
parent 7f2f83b16e
commit 03a7525218
8 changed files with 23 additions and 23 deletions

View File

@@ -1,12 +1,12 @@
#include "thread_abstraction.h"
Thread::Thread() :
SimpleThread::SimpleThread() :
mIsRunning(false),
mThread()
{
}
Thread::~Thread()
SimpleThread::~SimpleThread()
{
// if thread is still running on object destruction, cancel thread the hard way:
if (mIsRunning)
@@ -15,20 +15,20 @@ Thread::~Thread()
}
}
void Thread::startThread()
void SimpleThread::startThread()
{
mIsRunning = true;
pthread_create(&mThread, 0, &Thread::runThread, this);
pthread_create(&mThread, 0, &SimpleThread::runThread, this);
}
void Thread::joinThread()
void SimpleThread::joinThread()
{
pthread_join(mThread, 0);
mIsRunning = false;
}
void* Thread::runThread(void* ptr)
void* SimpleThread::runThread(void* ptr)
{
((Thread*)ptr)->run();
static_cast<SimpleThread*>(ptr)->run();
return 0;
}

View File

@@ -1,20 +1,20 @@
#ifndef _THREAD_ABSTRACTION_H
#define _THREAD_ABSTRACTION_H
#ifndef _SIMPLETHREAD_ABSTRACTION_H
#define _SIMPLETHREAD_ABSTRACTION_H
#include <pthread.h>
class Thread
class SimpleThread
{
bool mIsRunning;
pthread_t mThread;
static void* runThread(void*);
Thread(const Thread&);
const Thread& operator=(const Thread&);
SimpleThread(const SimpleThread&);
const SimpleThread& operator=(const SimpleThread&);
public:
Thread();
~Thread();
SimpleThread();
~SimpleThread();
void startThread();
void joinThread();