Ignore:
Timestamp:
Sep 25, 1999, 7:55:21 PM (26 years ago)
Author:
sandervl
Message:

Thread bugfixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/wprocess.cpp

    r966 r1052  
    1 /* $Id: wprocess.cpp,v 1.32 1999-09-18 12:07:35 sandervl Exp $ */
     1/* $Id: wprocess.cpp,v 1.33 1999-09-25 17:55:21 sandervl Exp $ */
    22
    33/*
     
    7575
    7676   //Allocate one dword to store the flat address of our TEB
    77    TIBFlatPtr = (DWORD *)OSLibAllocThreadLocalMemory(1);
    78    if(TIBFlatPtr == 0) {
    79         dprintf(("InitializeTIB: local thread memory alloc failed!!"));
    80         DebugInt3();
    81         return NULL;
     77   if(fMainThread) {
     78        TIBFlatPtr = (DWORD *)OSLibAllocThreadLocalMemory(1);
     79        if(TIBFlatPtr == 0) {
     80                dprintf(("InitializeTIB: local thread memory alloc failed!!"));
     81                DebugInt3();
     82                return NULL;
     83        }
    8284   }
    8385   if(OSLibAllocSel(PAGE_SIZE, &tibsel) == FALSE)
     
    188190   winteb = (TEB *)*TIBFlatPtr;
    189191   if(winteb) {
     192        thdb = (THDB *)(winteb+1);
     193        win32tibsel = thdb->teb_sel;
     194
     195        //Restore our win32 FS selector
     196        return SetReturnFS(win32tibsel);
     197   }
     198   else {
     199        //we didn't create this thread, so allocate a selector now
     200        //NOTE: Possible memory leak (i.e. DART threads in WINMM)
     201        winteb = InitializeTIB();
     202        if(winteb == NULL) {
     203                DebugInt3();
     204                return GetFS();
     205        }
    190206        thdb = (THDB *)(winteb+1);
    191207        win32tibsel = thdb->teb_sel;
Note: See TracChangeset for help on using the changeset viewer.