X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Tools%2Fnativelib%2Fthreads.c;h=9a4bfdfb68ed4b97e6afa4c8f338ac4c3bc90d47;hb=d1e3e105c7605d0c9f02dd7e2f3b1377ea61aea4;hp=b214f21cf00f78e2cc387d7b0c760c3c65bddc17;hpb=083c31409b9f25c96807ab8fef8ac79e8fe4cf9e;p=tpg%2Facess2.git diff --git a/Tools/nativelib/threads.c b/Tools/nativelib/threads.c index b214f21c..9a4bfdfb 100644 --- a/Tools/nativelib/threads.c +++ b/Tools/nativelib/threads.c @@ -22,7 +22,10 @@ tShortSpinlock glThreadListLock; // === CODE === void Threads_int_Init(void) { - lpThreads_This = Threads_int_CreateTCB(NULL); + if( !lpThreads_This ) { + lpThreads_This = Threads_int_CreateTCB(NULL); + Threads_SetName("ThreadZero"); + } } tThread *Proc_GetCurThread(void) @@ -70,7 +73,7 @@ void Threads_ClearEvent(Uint32 Mask) tUID Threads_GetUID(void) { return 0; } tGID Threads_GetGID(void) { return 0; } -tTID Threads_GetTID(void) { return lpThreads_This->TID; } +tTID Threads_GetTID(void) { return lpThreads_This ? lpThreads_This->TID : 0; } int *Threads_GetMaxFD(void) { return &lpThreads_This->Process->MaxFDs; } char **Threads_GetCWD(void) { return &lpThreads_This->Process->CWD; }