forked from mirrors/kolyah35-minecraft-pe-0.6.1
the whole game
This commit is contained in:
parent
816e9060b4
commit
f0617a5d22
2069 changed files with 581500 additions and 0 deletions
163
src/raknet/RakThread.cpp
Executable file
163
src/raknet/RakThread.cpp
Executable file
|
|
@ -0,0 +1,163 @@
|
|||
#include "RakThread.h"
|
||||
#include "RakAssert.h"
|
||||
#include "RakNetDefines.h"
|
||||
#include "RakSleep.h"
|
||||
#include "RakMemoryOverride.h"
|
||||
|
||||
using namespace RakNet;
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include "WindowsIncludes.h"
|
||||
#include <stdio.h>
|
||||
#if !defined(_WIN32_WCE)
|
||||
#include <process.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_WIN32_WCE)
|
||||
int RakThread::Create( LPTHREAD_START_ROUTINE start_address, void *arglist, int priority)
|
||||
#elif defined(_WIN32)
|
||||
int RakThread::Create( unsigned __stdcall start_address( void* ), void *arglist, int priority)
|
||||
|
||||
|
||||
|
||||
#else
|
||||
int RakThread::Create( void* start_address( void* ), void *arglist, int priority)
|
||||
#endif
|
||||
{
|
||||
#ifdef _WIN32
|
||||
HANDLE threadHandle;
|
||||
unsigned threadID = 0;
|
||||
|
||||
|
||||
#if defined (_WIN32_WCE)
|
||||
threadHandle = CreateThread(NULL,MAX_ALLOCA_STACK_ALLOCATION*2,start_address,arglist,0,(DWORD*)&threadID);
|
||||
SetThreadPriority(threadHandle, priority);
|
||||
#else
|
||||
threadHandle = (HANDLE) _beginthreadex( NULL, MAX_ALLOCA_STACK_ALLOCATION*2, start_address, arglist, 0, &threadID );
|
||||
#endif
|
||||
SetThreadPriority(threadHandle, priority);
|
||||
|
||||
if (threadHandle==0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
CloseHandle( threadHandle );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#else
|
||||
pthread_t threadHandle;
|
||||
// Create thread linux
|
||||
pthread_attr_t attr;
|
||||
sched_param param;
|
||||
param.sched_priority=priority;
|
||||
pthread_attr_init( &attr );
|
||||
pthread_attr_setschedparam(&attr, ¶m);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
pthread_attr_setstacksize(&attr, MAX_ALLOCA_STACK_ALLOCATION*2);
|
||||
|
||||
pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );
|
||||
int res = pthread_create( &threadHandle, &attr, start_address, arglist );
|
||||
RakAssert(res==0 && "pthread_create in RakThread.cpp failed.")
|
||||
return res;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue