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

Added GetTHDBFromThreadId + link THDB structures

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.