|
@@ -96,7 +96,7 @@ void rathread_final(){
|
|
|
|
|
|
|
|
|
|
// gets called whenever a thread terminated ..
|
|
// gets called whenever a thread terminated ..
|
|
-static void rat_thread_terminated( rAthread handle ){
|
|
|
|
|
|
+static void rat_thread_terminated( prAthread handle ){
|
|
|
|
|
|
int id_backup = handle->myID;
|
|
int id_backup = handle->myID;
|
|
|
|
|
|
@@ -117,7 +117,7 @@ static void *_raThreadMainRedirector( void *p ){
|
|
|
|
|
|
// Update myID @ TLS to right id.
|
|
// Update myID @ TLS to right id.
|
|
#ifdef HAS_TLS
|
|
#ifdef HAS_TLS
|
|
- g_rathread_ID = ((rAthread)p)->myID;
|
|
|
|
|
|
+ g_rathread_ID = ((prAthread)p)->myID;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#ifndef WIN32
|
|
#ifndef WIN32
|
|
@@ -135,13 +135,13 @@ static void *_raThreadMainRedirector( void *p ){
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
|
|
- ret = ((rAthread)p)->proc( ((rAthread)p)->param ) ;
|
|
|
|
|
|
+ ret = ((prAthread)p)->proc( ((prAthread)p)->param ) ;
|
|
|
|
|
|
#ifdef WIN32
|
|
#ifdef WIN32
|
|
- CloseHandle( ((rAthread)p)->hThread );
|
|
|
|
|
|
+ CloseHandle( ((prAthread)p)->hThread );
|
|
#endif
|
|
#endif
|
|
|
|
|
|
- rat_thread_terminated( (rAthread)p );
|
|
|
|
|
|
+ rat_thread_terminated( (prAthread)p );
|
|
#ifdef WIN32
|
|
#ifdef WIN32
|
|
return (DWORD)ret;
|
|
return (DWORD)ret;
|
|
#else
|
|
#else
|
|
@@ -156,18 +156,18 @@ static void *_raThreadMainRedirector( void *p ){
|
|
///
|
|
///
|
|
/// API Level
|
|
/// API Level
|
|
///
|
|
///
|
|
-rAthread rathread_create( rAthreadProc entryPoint, void *param ){
|
|
|
|
|
|
+prAthread rathread_create( rAthreadProc entryPoint, void *param ){
|
|
return rathread_createEx( entryPoint, param, (1<<23) /*8MB*/, RAT_PRIO_NORMAL );
|
|
return rathread_createEx( entryPoint, param, (1<<23) /*8MB*/, RAT_PRIO_NORMAL );
|
|
}//end: rathread_create()
|
|
}//end: rathread_create()
|
|
|
|
|
|
|
|
|
|
-rAthread rathread_createEx( rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio ){
|
|
|
|
|
|
+prAthread rathread_createEx( rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio ){
|
|
#ifndef WIN32
|
|
#ifndef WIN32
|
|
pthread_attr_t attr;
|
|
pthread_attr_t attr;
|
|
#endif
|
|
#endif
|
|
size_t tmp;
|
|
size_t tmp;
|
|
unsigned int i;
|
|
unsigned int i;
|
|
- rAthread handle = NULL;
|
|
|
|
|
|
+ prAthread handle = NULL;
|
|
|
|
|
|
|
|
|
|
// given stacksize aligned to systems pagesize?
|
|
// given stacksize aligned to systems pagesize?
|
|
@@ -214,7 +214,7 @@ rAthread rathread_createEx( rAthreadProc entryPoint, void *param, size_t szSta
|
|
}//end: rathread_createEx
|
|
}//end: rathread_createEx
|
|
|
|
|
|
|
|
|
|
-void rathread_destroy ( rAthread handle ){
|
|
|
|
|
|
+void rathread_destroy ( prAthread handle ){
|
|
#ifdef WIN32
|
|
#ifdef WIN32
|
|
if( TerminateThread(handle->hThread, 0) != FALSE){
|
|
if( TerminateThread(handle->hThread, 0) != FALSE){
|
|
CloseHandle(handle->hThread);
|
|
CloseHandle(handle->hThread);
|
|
@@ -233,9 +233,9 @@ void rathread_destroy ( rAthread handle ){
|
|
#endif
|
|
#endif
|
|
}//end: rathread_destroy()
|
|
}//end: rathread_destroy()
|
|
|
|
|
|
-rAthread rathread_self( ){
|
|
|
|
|
|
+prAthread rathread_self( ){
|
|
#ifdef HAS_TLS
|
|
#ifdef HAS_TLS
|
|
- rAthread handle = &l_threads[g_rathread_ID];
|
|
|
|
|
|
+ prAthread handle = &l_threads[g_rathread_ID];
|
|
|
|
|
|
if(handle->proc != NULL) // entry point set, so its used!
|
|
if(handle->proc != NULL) // entry point set, so its used!
|
|
return handle;
|
|
return handle;
|
|
@@ -279,7 +279,7 @@ int rathread_get_tid(){
|
|
}//end: rathread_get_tid()
|
|
}//end: rathread_get_tid()
|
|
|
|
|
|
|
|
|
|
-bool rathread_wait( rAthread handle, void* *out_exitCode ){
|
|
|
|
|
|
+bool rathread_wait( prAthread handle, void* *out_exitCode ){
|
|
|
|
|
|
// Hint:
|
|
// Hint:
|
|
// no thread data cleanup routine call here!
|
|
// no thread data cleanup routine call here!
|
|
@@ -297,13 +297,13 @@ bool rathread_wait( rAthread handle, void* *out_exitCode ){
|
|
}//end: rathread_wait()
|
|
}//end: rathread_wait()
|
|
|
|
|
|
|
|
|
|
-void rathread_prio_set( rAthread handle, RATHREAD_PRIO prio ){
|
|
|
|
|
|
+void rathread_prio_set( prAthread handle, RATHREAD_PRIO prio ){
|
|
handle->prio = RAT_PRIO_NORMAL;
|
|
handle->prio = RAT_PRIO_NORMAL;
|
|
//@TODO
|
|
//@TODO
|
|
}//end: rathread_prio_set()
|
|
}//end: rathread_prio_set()
|
|
|
|
|
|
|
|
|
|
-RATHREAD_PRIO rathread_prio_get( rAthread handle){
|
|
|
|
|
|
+RATHREAD_PRIO rathread_prio_get( prAthread handle){
|
|
return handle->prio;
|
|
return handle->prio;
|
|
}//end: rathread_prio_get()
|
|
}//end: rathread_prio_get()
|
|
|
|
|