56 lines
856 B
C++
56 lines
856 B
C++
#include "Precompiled.h"
|
|
|
|
|
|
|
|
|
|
#include "RakiEngine/System/RakiThread.h"
|
|
|
|
|
|
#include "RakiEngine/System/ThreadBase/ThreadBase.h"
|
|
|
|
|
|
|
|
namespace raki
|
|
{
|
|
|
|
|
|
void* RakiThread_Function( void * _data )
|
|
{
|
|
RAKI_ASSERT( _data );
|
|
|
|
ThreadBase * object = (ThreadBase*) _data;
|
|
|
|
Thread::theThread( object );
|
|
|
|
return NULL;
|
|
}
|
|
|
|
|
|
void Thread::theThread( ThreadBase * _object )
|
|
{
|
|
RAKI_OUTPUT( "Thread::theThread launching thread on Thread 0x%x", _object );
|
|
|
|
_object->internalRun();
|
|
}
|
|
|
|
bool Thread::beginThread( ThreadBase * _object )
|
|
{
|
|
ScePthread thread;
|
|
ScePthreadAttr threadAttr;
|
|
scePthreadAttrInit(&threadAttr);
|
|
scePthreadCreate(&thread, &threadAttr, RakiThread_Function, _object, NULL);
|
|
scePthreadAttrDestroy(&threadAttr);
|
|
|
|
return ( thread != NULL );
|
|
}
|
|
|
|
void Thread::sleep( u32 _milliseconds )
|
|
{
|
|
sceKernelUsleep( _milliseconds * 1000 );
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|