_WCRTLINK int (raise)( int sig ) { pid_t me; __getmagicvar( &me, _m_my_pid ); return( kill( me, sig ) ); }
_WCRTLINK int *__get_errno_ptr( void ) { #if defined(__386__) void *err_ptr; __getmagicvar( &err_ptr, _m_errno_ptr ); return( err_ptr ); #else return( (int *)&__MAGIC.Errno ); #endif }
void __QNXRemoveThread( void ) /****************************/ { void *tmp; thread_data *tdata; __getmagicvar( &tmp, _m_thread_data ); if( tmp != NULL ) { tdata = tmp; if( tdata->__allocated ) { lib_free( tdata ); } tmp = 0; __setmagicvar( &tmp, _m_thread_data ); } }
thread_data *__MultipleThread( void ) { #if defined( __NT__ ) /* * Preserve old error code -- important because this code can get * called from _STK. */ DWORD old = GetLastError(); thread_data *tdata; tdata = (thread_data *)TlsGetValue( __TlsIndex ); if( tdata == NULL ) { tdata = __GetThreadData(); } else if( tdata->__resize ) { tdata = __ReallocThreadData(); } SetLastError(old); return( tdata ); #elif defined (_NETWARE_LIBC) /* * Preserve old error code -- important because this code can get * called from _STK. */ int old = GetLastError(); int ccode = 0; thread_data *tdata = NULL; if(0 != (ccode = NXKeyGetValue(__NXSlotID, (void **) &tdata))) tdata = NULL; if( tdata == NULL ) { tdata = __GetThreadData(); } else if( tdata->__resize ) { tdata = __ReallocThreadData(); } SetLastError(old); return( tdata ); #elif defined( __WARP__ ) // 32 bit OS/2 TID tid; thread_data *tdata = NULL; tid = GetCurrentThreadId(); if( tid <= __MaxThreads ) { tdata = __ThreadData[tid].data; } if( tdata == NULL ) { tdata = __GetThreadData(); } else if( tdata->__resize ) { tdata = __ReallocThreadData(); } return( tdata ); #elif defined( __OS2_286__ ) // 16 bit OS/2 return( __ThreadData[GetCurrentThreadId()] ); #elif defined( __QNX__ ) void *tdata; __getmagicvar( &tdata, _m_thread_data ); if( tdata == NULL ) { tdata = __QNXAddThread( tdata ); } return( tdata ); #elif defined( __LINUX__ ) // TODO: Init multiple threads for Linux! return( NULL ); #elif defined( __RDOS__ ) thread_data *tdata; tdata = (thread_data *)__tls_get_value( __TlsIndex ); if( tdata == NULL ) tdata = __GetThreadData(); return( tdata ); #elif defined( __RDOSDEV__ ) return( NULL ); #else return( __ThreadData[GetCurrentThreadId()].data ); #endif }