mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-24 13:13:51 +00:00
Initial commit
This commit is contained in:
parent
def8cb4153
commit
b691c43c44
19437 changed files with 4363922 additions and 0 deletions
|
|
@ -0,0 +1,41 @@
|
|||
#include <pthread.h>
|
||||
#include "../IThread.h"
|
||||
|
||||
void* InternalThread(void* a_UserData)
|
||||
{
|
||||
ThreadFunction function = (ThreadFunction)a_UserData;
|
||||
function();
|
||||
|
||||
pthread_exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
class ThreadPS3 : public IThread
|
||||
{
|
||||
public:
|
||||
virtual void Fork(ThreadFunction a_Function)
|
||||
{
|
||||
pthread_create(&m_Thread, 0, InternalThread, (void*)a_Function);
|
||||
}
|
||||
|
||||
virtual void Join()
|
||||
{
|
||||
void* threadResult;
|
||||
pthread_join(m_Thread, &threadResult);
|
||||
}
|
||||
|
||||
private:
|
||||
pthread_t m_Thread;
|
||||
};
|
||||
|
||||
|
||||
IThread* CreateThread()
|
||||
{
|
||||
return new ThreadPS3();
|
||||
}
|
||||
|
||||
void DestroyThread(IThread* a_Thread)
|
||||
{
|
||||
delete a_Thread;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue