- Timestamp:
- Mar 23, 2000, 8:23:48 PM (25 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/KERNEL32.DEF
r3074 r3206 1 ; $Id: KERNEL32.DEF,v 1.7 4 2000-03-10 16:11:59sandervl Exp $1 ; $Id: KERNEL32.DEF,v 1.75 2000-03-23 19:23:46 sandervl Exp $ 2 2 3 3 ;Created by BLAST for IBM's compiler … … 979 979 980 980 ;VMutex 981 enter__6VMutexFUl 982 leave__6VMutexF v@1205983 __ct__6VMutexFi 981 enter__6VMutexFUlPUl @1204 982 leave__6VMutexFPUl @1205 983 __ct__6VMutexFiPUl @1206 984 984 __dt__6VMutexFv @1207 985 985 … … 1063 1063 ;code memory allocation 1064 1064 _cmalloc__FUi @1272 1065 1066 ;VSemaphore 1067 wait__10VSemaphoreFUlPUl @1280 1068 post__10VSemaphoreFPUl @1281 1069 reset__10VSemaphoreFPUl @1282 1070 __ct__10VSemaphoreFiPUl @1283 1071 __dt__10VSemaphoreFv @1284 1065 1072 1066 1073 ;Export for MSACM32 -
trunk/src/kernel32/dbglocal.cpp
r3128 r3206 1 /* $Id: dbglocal.cpp,v 1. 4 2000-03-16 19:20:37sandervl Exp $ */1 /* $Id: dbglocal.cpp,v 1.5 2000-03-23 19:23:44 sandervl Exp $ */ 2 2 3 3 /* … … 114 114 "queue", 115 115 "hmthread", 116 "hmprocess" 116 "hmprocess", 117 "vsemaphore" 117 118 }; 118 119 //****************************************************************************** -
trunk/src/kernel32/dbglocal.h
r3128 r3206 1 /* $Id: dbglocal.h,v 1. 4 2000-03-16 19:20:37sandervl Exp $ */1 /* $Id: dbglocal.h,v 1.5 2000-03-23 19:23:45 sandervl Exp $ */ 2 2 3 3 /* … … 115 115 #define DBG_hmthread 94 116 116 #define DBG_hmprocess 95 117 #define DBG_MAXFILES 96 117 #define DBG_VSemaphore 96 118 #define DBG_MAXFILES 97 118 119 119 120 extern USHORT DbgEnabled[DBG_MAXFILES]; -
trunk/src/kernel32/makefile
r3128 r3206 1 # $Id: makefile,v 1.9 1 2000-03-16 19:20:39sandervl Exp $1 # $Id: makefile,v 1.92 2000-03-23 19:23:46 sandervl Exp $ 2 2 3 3 # … … 20 20 # Flag overloads and local macros. 21 21 CLEANEXTRAS = kernelrsrc.asm 22 23 #CFLAGS = $(CFLAGS) -DDEBUG 24 #CXXFLAGS = $(CXXFLAGS) /Fa+ 22 25 23 26 … … 59 62 $(OBJDIR)\os2heap.OBJ \ 60 63 $(OBJDIR)\vmutex.OBJ \ 64 $(OBJDIR)\vsemaphore.OBJ \ 61 65 $(OBJDIR)\initterm.OBJ \ 62 66 $(OBJDIR)\handlemanager.OBJ \ -
trunk/src/kernel32/mmap.cpp
r3059 r3206 1 /* $Id: mmap.cpp,v 1.3 6 2000-03-09 19:03:19sandervl Exp $ */1 /* $Id: mmap.cpp,v 1.37 2000-03-23 19:23:47 sandervl Exp $ */ 2 2 3 3 /* … … 35 35 #include "dbglocal.h" 36 36 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 40 HMTX hGlobalMapMutex = 0; 41 37 42 //Global DLL Data 38 43 #pragma data_seg(_GLOBALDATA) 39 44 Win32MemMap *Win32MemMap::memmaps = NULL; 40 VMutex globalmapMutex(VMUTEX_SHARED );45 VMutex globalmapMutex(VMUTEX_SHARED, &hGlobalMapMutex); 41 46 #pragma data_seg() 42 47 VMutex globalviewMutex; … … 49 54 : nrMappings(0), pMapping(NULL), mMapAccess(0), referenced(0), image(0) 50 55 { 51 globalmapMutex.enter( );56 globalmapMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalMapMutex); 52 57 next = memmaps; 53 58 memmaps = this; 54 globalmapMutex.leave( );59 globalmapMutex.leave(&hGlobalMapMutex); 55 60 56 61 hMemFile = hfile; … … 72 77 : nrMappings(0), pMapping(NULL), mMapAccess(0), referenced(0) 73 78 { 74 globalmapMutex.enter( );79 globalmapMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalMapMutex); 75 80 next = memmaps; 76 81 memmaps = this; 77 globalmapMutex.leave( );82 globalmapMutex.leave(&hGlobalMapMutex); 78 83 79 84 hMemFile = -1; … … 148 153 mapMutex.leave(); 149 154 150 globalmapMutex.enter( );155 globalmapMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalMapMutex); 151 156 Win32MemMap *map = memmaps; 152 157 … … 165 170 else dprintf(("Win32MemMap::~Win32MemMap: map not found!! (%x)", this)); 166 171 } 167 globalmapMutex.leave( );172 globalmapMutex.leave(&hGlobalMapMutex); 168 173 } 169 174 //****************************************************************************** … … 467 472 return NULL; 468 473 469 globalmapMutex.enter( );474 globalmapMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalMapMutex); 470 475 Win32MemMap *map = memmaps; 471 476 … … 477 482 } 478 483 } 479 globalmapMutex.leave( );484 globalmapMutex.leave(&hGlobalMapMutex); 480 485 if(!map) dprintf(("Win32MemMap::findMap: couldn't find map %s", lpszName)); 481 486 return map; … … 485 490 Win32MemMap *Win32MemMap::findMap(ULONG address) 486 491 { 487 globalmapMutex.enter( );492 globalmapMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalMapMutex); 488 493 Win32MemMap *map = memmaps; 489 494 … … 498 503 } 499 504 } 500 globalmapMutex.leave( );505 globalmapMutex.leave(&hGlobalMapMutex); 501 506 return map; 502 507 } -
trunk/src/kernel32/vmutex.cpp
r2802 r3206 1 /* $Id: vmutex.cpp,v 1. 8 2000-02-16 14:22:47 sandervl Exp $ */1 /* $Id: vmutex.cpp,v 1.9 2000-03-23 19:23:47 sandervl Exp $ */ 2 2 3 3 /* 4 4 * Mutex class 5 5 * 6 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)6 * Copyright 1998-2000 Sander van Leeuwen (sandervl@xs4all.nl) 7 7 * 8 * 9 * NOTE: When creating a shared mutex object, you must call the ctor, enter & 10 * leave with a 2nd parameter (HMTX *). This mutex handle must be located 11 * in the local data segment of the dll. 12 * This enables other processes than the one that created the mutex object 13 * to access it 8 14 * 9 15 * Project Odin Software License can be found in LICENSE.TXT 10 16 * 11 17 */ 12 #define INCL_DOSSEMAPHORES 18 #define INCL_DOSSEMAPHORES 19 #define INCL_DOSERRORS 13 20 #include <os2wrap.h> //Odin32 OS/2 api wrappers 14 21 #include <vmutex.h> … … 21 28 /******************************************************************************/ 22 29 /******************************************************************************/ 23 VMutex::VMutex(int fShared ) : waiting(0)30 VMutex::VMutex(int fShared, HMTX *phMutex) : waiting(0) 24 31 { 25 32 APIRET rc; 26 33 34 this->fShared = fShared; 27 35 rc = DosCreateMutexSem(NULL, &sem_handle, (fShared == VMUTEX_SHARED) ? DC_SEM_SHARED : 0, FALSE); 28 36 if(rc != 0) { 29 37 dprintf(("Error creating mutex %X\n", rc)); 30 38 sem_handle = 0; 39 } 40 if(fShared) { 41 *phMutex = sem_handle; 31 42 } 32 43 } … … 38 49 39 50 if(sem_handle) { 40 for(i=0;i<waiting;i++) { 41 DosReleaseMutexSem(sem_handle); 42 } 43 DosCloseMutexSem(sem_handle); 51 if(fShared != VMUTEX_SHARED) { 52 for(i=0;i<waiting;i++) { 53 DosReleaseMutexSem(sem_handle); 54 } 55 } 56 DosCloseMutexSem(sem_handle); 44 57 } 45 58 } 46 59 /******************************************************************************/ 47 60 /******************************************************************************/ 48 void VMutex::enter(ULONG timeout )61 void VMutex::enter(ULONG timeout, HMTX *phMutex) 49 62 { 63 APIRET rc; 64 65 if(fShared == VMUTEX_SHARED && phMutex == NULL) { 66 DebugInt3(); 67 return; 68 } 50 69 if(sem_handle) { 51 waiting++; 52 DosRequestMutexSem(sem_handle, timeout); 53 waiting--; 70 if(fShared == VMUTEX_SHARED && *phMutex == 0) { 71 //must open the shared semaphore first (other process created it) 72 *phMutex = sem_handle; 73 rc = DosOpenMutexSem(NULL, phMutex); 74 if(rc) { 75 DebugInt3(); 76 } 77 } 78 waiting++; 79 rc = DosRequestMutexSem((fShared == VMUTEX_SHARED) ? *phMutex : sem_handle, timeout); 80 waiting--; 54 81 } 55 82 } 56 83 /******************************************************************************/ 57 84 /******************************************************************************/ 58 void VMutex::leave( )85 void VMutex::leave(HMTX *phMutex) 59 86 { 60 DosReleaseMutexSem(sem_handle); 87 if((fShared == VMUTEX_SHARED && phMutex == NULL) || 88 (fShared == VMUTEX_SHARED && *phMutex == 0)) { 89 DebugInt3(); 90 //should always call enter first... 91 return; 92 } 93 DosReleaseMutexSem((fShared == VMUTEX_SHARED) ? *phMutex : sem_handle); 61 94 } 62 95 /******************************************************************************/ -
trunk/src/kernel32/winimagepeldr.cpp
r3059 r3206 1 /* $Id: winimagepeldr.cpp,v 1.3 5 2000-03-09 19:03:22sandervl Exp $ */1 /* $Id: winimagepeldr.cpp,v 1.36 2000-03-23 19:23:48 sandervl Exp $ */ 2 2 3 3 /* … … 1178 1178 ULONG nsize; 1179 1179 1180 if(!strcmp(apiname, "At")) 1181 DebugInt3(); 1180 1182 if(nameexports == NULL) { 1181 1183 nameExportSize= 4096; … … 1518 1520 strcpy(tmp, name); 1519 1521 apiname = tmp; 1522 apilen = 4; 1520 1523 } 1521 1524 else apiname = name;
Note:
See TracChangeset
for help on using the changeset viewer.