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

mutex fixes + added vsemaphore class

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/mmap.cpp

    r3059 r3206  
    1 /* $Id: mmap.cpp,v 1.36 2000-03-09 19:03:19 sandervl Exp $ */
     1/* $Id: mmap.cpp,v 1.37 2000-03-23 19:23:47 sandervl Exp $ */
    22
    33/*
     
    3535#include "dbglocal.h"
    3636
     37//NOTE: This must be in the local data segment -> if a shared semaphore was
     38//      created by a different process, the handle returned by DosOpenMutexSem
     39//      will be returned in hGlobalMapMutex
     40HMTX             hGlobalMapMutex = 0;
     41
    3742//Global DLL Data
    3843#pragma data_seg(_GLOBALDATA)
    3944Win32MemMap     *Win32MemMap::memmaps = NULL;
    40 VMutex           globalmapMutex(VMUTEX_SHARED);
     45VMutex           globalmapMutex(VMUTEX_SHARED, &hGlobalMapMutex);
    4146#pragma data_seg()
    4247VMutex           globalviewMutex;
     
    4954               : nrMappings(0), pMapping(NULL), mMapAccess(0), referenced(0), image(0)
    5055{
    51   globalmapMutex.enter();
     56  globalmapMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalMapMutex);
    5257  next    = memmaps;
    5358  memmaps = this;
    54   globalmapMutex.leave();
     59  globalmapMutex.leave(&hGlobalMapMutex);
    5560
    5661  hMemFile   = hfile;
     
    7277               : nrMappings(0), pMapping(NULL), mMapAccess(0), referenced(0)
    7378{
    74   globalmapMutex.enter();
     79  globalmapMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalMapMutex);
    7580  next    = memmaps;
    7681  memmaps = this;
    77   globalmapMutex.leave();
     82  globalmapMutex.leave(&hGlobalMapMutex);
    7883
    7984  hMemFile   = -1;
     
    148153  mapMutex.leave();
    149154
    150   globalmapMutex.enter();
     155  globalmapMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalMapMutex);
    151156  Win32MemMap *map = memmaps;
    152157
     
    165170        else    dprintf(("Win32MemMap::~Win32MemMap: map not found!! (%x)", this));
    166171  }
    167   globalmapMutex.leave();
     172  globalmapMutex.leave(&hGlobalMapMutex);
    168173}
    169174//******************************************************************************
     
    467472        return NULL;
    468473
    469   globalmapMutex.enter();
     474  globalmapMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalMapMutex);
    470475  Win32MemMap *map = memmaps;
    471476
     
    477482        }
    478483  }
    479   globalmapMutex.leave();
     484  globalmapMutex.leave(&hGlobalMapMutex);
    480485  if(!map) dprintf(("Win32MemMap::findMap: couldn't find map %s", lpszName));
    481486  return map;
     
    485490Win32MemMap *Win32MemMap::findMap(ULONG address)
    486491{
    487   globalmapMutex.enter();
     492  globalmapMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalMapMutex);
    488493  Win32MemMap *map = memmaps;
    489494
     
    498503        }
    499504  }
    500   globalmapMutex.leave();
     505  globalmapMutex.leave(&hGlobalMapMutex);
    501506  return map;
    502507}
Note: See TracChangeset for help on using the changeset viewer.