Changeset 8202 for trunk/src/user32


Ignore:
Timestamp:
Apr 7, 2002, 4:38:08 PM (23 years ago)
Author:
sandervl
Message:

changed vmutex usage

Location:
trunk/src/user32
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/HOOK.CPP

    r8132 r8202  
    1 /* $Id: HOOK.CPP,v 1.36 2002-03-28 16:20:06 sandervl Exp $ */
     1/* $Id: HOOK.CPP,v 1.37 2002-04-07 14:36:59 sandervl Exp $ */
    22
    33/*
     
    8080
    8181#define CHECK_MAGIC(a) ((a != 0) && (((HOOKDATA *)a)->magic == HOOK_MAGIC))
    82 
    83 //NOTE: This must be in the local data segment -> if a shared semaphore was
    84 //      created by a different process, the handle returned by DosOpenMutexSem
    85 //      will be returned in hGlobalHookMutex
    86 static HMTX hGlobalHookMutex = 0;
    8782
    8883//Global DLL Data
  • trunk/src/user32/inituser32.cpp

    r7640 r8202  
    1 /* $Id: inituser32.cpp,v 1.10 2001-12-16 15:30:14 sandervl Exp $ */
     1/* $Id: inituser32.cpp,v 1.11 2002-04-07 14:36:59 sandervl Exp $ */
    22/*
    33 * USER32 DLL entry point
     
    4343#include "pmwindow.h"
    4444#include "win32wdesktop.h"
     45#include "win32wndhandle.h"
    4546#include "syscolor.h"
    4647#include "initterm.h"
     
    218219         pmkbdhk_initialize(hab);
    219220
     221         InitializeWindowHandles();
     222
    220223         //SvL: 18-7-'98, Register system window classes (button, listbox etc etc)
    221224         //CB: register internal classes
     
    225228         MONITOR_Initialize(&MONITOR_PrimaryMonitor);
    226229
    227        break;
     230         break;
    228231     
    229232     
  • trunk/src/user32/win32wndhandle.cpp

    r7097 r8202  
    1 /* $Id: win32wndhandle.cpp,v 1.10 2001-10-17 15:16:58 phaller Exp $ */
     1/* $Id: win32wndhandle.cpp,v 1.11 2002-04-07 14:37:00 sandervl Exp $ */
    22/*
    33 * Win32 Handle Management Code for OS/2
     
    2525//******************************************************************************
    2626
    27 //NOTE: This must be in the local data segment -> if a shared semaphore was
    28 //      created by a different process, the handle returned by DosOpenMutexSem
    29 //      will be returned in hGlobalTableMutex
    30 HMTX hGlobalTableMutex = 0;
    31 
    3227//Global DLL Data
    3328#pragma data_seg(_GLOBALDATA)
    34 ULONG  WindowHandleTable[MAX_WINDOW_HANDLES] = {0};
    35 VMutex tableMutex(VMUTEX_SHARED, &hGlobalTableMutex);
     29ULONG                WindowHandleTable[MAX_WINDOW_HANDLES] = {0};
     30CRITICAL_SECTION_OS2 globalwhandlecritsect = {0};
    3631ULONG  lastIndex = 0;
    3732#pragma data_seg()
     
    3934//******************************************************************************
    4035//******************************************************************************
     36void InitializeWindowHandles()
     37{
     38    if(globalwhandlecritsect.hmtxLock == 0) {
     39         DosInitializeCriticalSection(&globalwhandlecritsect, WINHANDLE_CRITSECTION_NAME);
     40    }
     41    else {
     42         dprintf(("InitializeWindowHandles -> access shared critical section"));
     43         DosAccessCriticalSection(&globalwhandlecritsect, WINHANDLE_CRITSECTION_NAME);
     44    }
     45}
     46//******************************************************************************
     47//******************************************************************************
    4148BOOL HwAllocateWindowHandle(HWND *hwnd, DWORD dwUserData)
    4249{
    43   tableMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalTableMutex);
     50  DosEnterCriticalSection(&globalwhandlecritsect);
    4451
    4552  //find next free handle
     
    5562  if(i == MAX_WINDOW_HANDLES) {
    5663        //oops, out of handles
    57         tableMutex.leave(&hGlobalTableMutex);
     64        DosLeaveCriticalSection(&globalwhandlecritsect);
    5865        dprintf(("ERROR: USER32: HwAllocateWindowHandle OUT OF WINDOW HANDLES!!"));
    5966        DebugInt3();
     
    6572
    6673  lastIndex++;
    67   tableMutex.leave(&hGlobalTableMutex);
     74  DosLeaveCriticalSection(&globalwhandlecritsect);
    6875  return TRUE;
    6976}
     
    7481  hwnd &= WNDHANDLE_MAGIC_MASK;
    7582  if(hwnd < MAX_WINDOW_HANDLES) {
    76         tableMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalTableMutex);
     83        DosEnterCriticalSection(&globalwhandlecritsect);
    7784        WindowHandleTable[hwnd] = 0;
    78         tableMutex.leave(&hGlobalTableMutex);
     85        DosLeaveCriticalSection(&globalwhandlecritsect);
    7986  }
    8087}
  • trunk/src/user32/win32wndhandle.h

    r2469 r8202  
    1 /* $Id: win32wndhandle.h,v 1.4 2000-01-18 20:08:18 sandervl Exp $ */
     1/* $Id: win32wndhandle.h,v 1.5 2002-04-07 14:37:00 sandervl Exp $ */
    22/*
    33 * Win32 Handle Management Code for OS/2
     
    1717#define WNDHANDLE_MAGIC_MASK     0x0000FFFF
    1818
     19#define WINHANDLE_CRITSECTION_NAME "\\SEM32\\ODIN_WINHANDLE.SEM"
     20
     21void  InitializeWindowHandles();
    1922BOOL  HwAllocateWindowHandle(HWND *hwnd, DWORD dwUserData);
    2023void  HwFreeWindowHandle(HWND hwnd);
Note: See TracChangeset for help on using the changeset viewer.