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

changed vmutex usage

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.