Changeset 3207 for trunk/src


Ignore:
Timestamp:
Mar 23, 2000, 8:24:26 PM (25 years ago)
Author:
sandervl
Message:

shared mutex fixes

Location:
trunk/src/user32
Files:
2 edited

Legend:

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

    r2948 r3207  
    1 /* $Id: HOOK.CPP,v 1.12 2000-02-29 19:16:11 sandervl Exp $ */
     1/* $Id: HOOK.CPP,v 1.13 2000-03-23 19:24:25 sandervl Exp $ */
    22
    33/*
     
    6262#define CHECK_MAGIC(a) ((a != 0) && (((HOOKDATA *)a)->magic == HOOK_MAGIC))
    6363
     64//NOTE: This must be in the local data segment -> if a shared semaphore was
     65//      created by a different process, the handle returned by DosOpenMutexSem
     66//      will be returned in hGlobalHookMutex
     67static HMTX hGlobalHookMutex = 0;
     68
    6469//Global DLL Data
    6570#pragma data_seg(_GLOBALDATA)
    6671static HANDLE HOOK_systemHooks[WH_NB_HOOKS] = { 0 };
    67 static VMutex systemHookMutex(TRUE);
     72static VMutex systemHookMutex(VMUTEX_SHARED, &hGlobalHookMutex);
    6873#pragma data_seg()
    6974static HANDLE HOOK_threadHooks[WH_NB_HOOKS] = { 0 };
     
    309314    else
    310315    {
    311         systemHookMutex.enter();
     316        systemHookMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalHookMutex);
    312317        data->next = HOOK_systemHooks[id - WH_MINHOOK];
    313318        HOOK_systemHooks[id - WH_MINHOOK] = (HANDLE)data;
    314         systemHookMutex.leave();
     319        systemHookMutex.leave(&hGlobalHookMutex);
    315320    }
    316321
  • trunk/src/user32/win32wndhandle.cpp

    r3127 r3207  
    1 /* $Id: win32wndhandle.cpp,v 1.6 2000-03-16 19:19:11 sandervl Exp $ */
     1/* $Id: win32wndhandle.cpp,v 1.7 2000-03-23 19:24:26 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
     30HMTX hGlobalTableMutex = 0;
     31
    2732//Global DLL Data
    2833#pragma data_seg(_GLOBALDATA)
    2934ULONG  WindowHandleTable[MAX_WINDOW_HANDLES] = {0};
    30 VMutex tableMutex(TRUE);
     35VMutex tableMutex(VMUTEX_SHARED, &hGlobalTableMutex);
    3136ULONG  lowestFreeIndex = 0;
    3237#pragma data_seg()
     
    3641BOOL HwAllocateWindowHandle(HWND *hwnd, DWORD dwUserData)
    3742{
    38   tableMutex.enter();
     43  tableMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalTableMutex);
    3944  if(lowestFreeIndex == -1) {
    4045        //oops, out of handles
    4146        dprintf(("USER32: HwAllocateWindowHandle OUT OF WINDOW HANDLES!!"));
    42         tableMutex.leave();
     47        tableMutex.leave(&hGlobalTableMutex);
    4348        DebugInt3();
    4449        return FALSE;
     
    5762        }
    5863  }
    59   tableMutex.leave();
     64  tableMutex.leave(&hGlobalTableMutex);
    6065  return TRUE;
    6166}
     
    6671  hwnd &= WNDHANDLE_MAGIC_MASK;
    6772  if(hwnd < MAX_WINDOW_HANDLES) {
    68         tableMutex.enter();
     73        tableMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalTableMutex);
    6974        WindowHandleTable[hwnd] = 0;
    7075        if(lowestFreeIndex == -1 || hwnd < lowestFreeIndex)
    7176                lowestFreeIndex = hwnd;
    7277
    73         tableMutex.leave();
     78        tableMutex.leave(&hGlobalTableMutex);
    7479  }
    7580}
Note: See TracChangeset for help on using the changeset viewer.