Changeset 2085


Ignore:
Timestamp:
Dec 16, 1999, 1:12:55 AM (25 years ago)
Author:
sandervl
Message:

Added GetTHDBFromThreadId + link THDB structures

Location:
trunk/src/kernel32
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/kernel32/KERNEL32.DEF

    r2061 r2085  
    1 ; $Id: KERNEL32.DEF,v 1.57 1999-12-12 14:32:37 sandervl Exp $
     1; $Id: KERNEL32.DEF,v 1.58 1999-12-16 00:12:54 sandervl Exp $
    22
    33;Created by BLAST for IBM's compiler
     
    10161016   HMHandleTranslateToOS2__FUlPUl                                 @1233
    10171017
    1018    GetThreadTEB         = _GetThreadTEB@0                         @1234
    1019    GetThreadTHDB        = _GetThreadTHDB@0                        @1235
     1018   _GetThreadTEB@0                                                @1234
     1019   _GetThreadTHDB@0                                               @1235
     1020   _GetTHDBFromThreadId@4                                         @1255
    10201021
    10211022; HEAP Management (heap.cpp, heapstring.cpp)
  • TabularUnified trunk/src/kernel32/wprocess.cpp

    r2077 r2085  
    1 /* $Id: wprocess.cpp,v 1.58 1999-12-14 19:14:28 sandervl Exp $ */
     1/* $Id: wprocess.cpp,v 1.59 1999-12-16 00:12:55 sandervl Exp $ */
    22
    33/*
     
    55 *
    66 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
    7  *
    87 *
    98 * NOTE: Even though Odin32 OS/2 apps don't switch FS selectors,
     
    2524#include <windllpeldr.h>
    2625#include <winfakepeldr.h>
     26#include <vmutex.h>
    2727
    2828#ifdef __IBMCPP__
     
    5353DWORD    *TIBFlatPtr    = 0;
    5454
     55//list of thread database structures
     56static THDB     *threadList = 0;
     57static VMutex    threadListMutex;
    5558//******************************************************************************
    5659//******************************************************************************
     
    7982
    8083  return thdb;
     84}
     85//******************************************************************************
     86//******************************************************************************
     87THDB *WIN32API GetTHDBFromThreadId(ULONG threadId)
     88{
     89 THDB *thdb = threadList;
     90
     91   threadListMutex.enter();
     92   while(thdb) {
     93        if(thdb->threadId == threadId) {
     94                break;
     95        }
     96        thdb = thdb->next;
     97   }
     98   threadListMutex.leave();
     99   return thdb;
    81100}
    82101//******************************************************************************
     
    133152   thdb->OrgTIBSel       = GetFS();
    134153   thdb->pWsockData      = NULL;
     154   thdb->threadId        = GetCurrentThreadId();
     155
     156   threadListMutex.enter();
     157   THDB *thdblast        = threadList;
     158   if(!thdblast) {
     159        threadList = thdb;
     160   }
     161   else {
     162        while(thdblast->next) {
     163                thdblast = thdblast->next;
     164        }
     165        thdblast->next   = thdb;
     166   }
     167   thdb->next            = NULL;
     168   threadListMutex.leave();
    135169
    136170   if(OSLibGetPIB(PIB_TASKTYPE) == TASKTYPE_PM)
    137171   {
    138     thdb->flags      = 0;  //todo gui
     172        thdb->flags      = 0;  //todo gui
    139173   }
    140174   else thdb->flags      = 0;  //todo textmode
     
    145179        //todo: initialize TLS array if required
    146180        //TLS in executable always TLS index 0?
    147     ProcessTIBSel = tibsel;
     181        ProcessTIBSel = tibsel;
    148182        ProcessPDB.exit_code       = 0x103; /* STILL_ACTIVE */
    149183        ProcessPDB.threads         = 1;
     
    159193        ProcessPDB.server_pid      = (void *)GetCurrentProcessId();
    160194
    161     GetSystemTime(&ProcessPDB.creationTime);
     195        GetSystemTime(&ProcessPDB.creationTime);
    162196
    163197        /* Initialize the critical section */
Note: See TracChangeset for help on using the changeset viewer.