move libthread to libstb-hal

This commit is contained in:
smogm
2015-01-12 18:15:08 +01:00
parent 3ef2eeb8aa
commit 95ee7f9e98
25 changed files with 915 additions and 86 deletions

View File

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