Changeset 9336 for trunk/src/odincrt/critsect.cpp
- Timestamp:
- Oct 8, 2002, 11:49:08 AM (23 years ago)
- File:
-
- 1 edited
-
trunk/src/odincrt/critsect.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/odincrt/critsect.cpp
r9331 r9336 1 /* $Id: critsect.cpp,v 1. 6 2002-10-07 16:28:13sandervl Exp $ */1 /* $Id: critsect.cpp,v 1.7 2002-10-08 09:49:06 sandervl Exp $ */ 2 2 /* 3 3 * Critical sections in the Win32 sense … … 72 72 * DosInitializeCriticalSection 73 73 */ 74 ULONG WIN32API DosInitializeCriticalSection(CRITICAL_SECTION_OS2 *crit, PSZ pszSemName) 74 ULONG WIN32API DosInitializeCriticalSection(CRITICAL_SECTION_OS2 *crit, 75 PSZ pszSemName, BOOL fShared) 75 76 { 76 77 APIRET rc; … … 81 82 crit->OwningThread = 0; 82 83 83 rc = DosCreateEventSem(pszSemName, &crit->hmtxLock, (pszSemName ) ? DC_SEM_SHARED : 0, 0);84 rc = DosCreateEventSem(pszSemName, &crit->hmtxLock, (pszSemName || fShared) ? DC_SEM_SHARED : 0, 0); 84 85 if(rc != NO_ERROR) { 85 86 DebugInt3(); … … 87 88 return rc; 88 89 } 90 crit->CreationCount = 1; 89 91 crit->Reserved = GetCurrentProcessId(); 90 92 return NO_ERROR; … … 95 97 * DosAccessCriticalSection 96 98 */ 97 ULONG WIN32API DosAccessCriticalSection(CRITICAL_SECTION_OS2 * , PSZ pszSemName)99 ULONG WIN32API DosAccessCriticalSection(CRITICAL_SECTION_OS2 *crit, PSZ pszSemName) 98 100 { 99 101 HMTX hmtxLock = 0; 100 102 APIRET rc; 101 103 104 if(pszSemName == NULL && crit->hmtxLock == 0) { 105 DebugInt3(); 106 return ERROR_INVALID_PARAMETER; 107 } 102 108 if(pszSemName == NULL) { 103 DebugInt3(); 104 return ERROR_INVALID_PARAMETER; 109 hmtxLock = crit->hmtxLock; 105 110 } 106 111 … … 110 115 return rc; 111 116 } 117 DosInterlockedIncrement(&crit->CreationCount); 112 118 return NO_ERROR; 113 119 } … … 123 129 DebugInt3(); 124 130 } 125 crit->LockCount = -1;126 crit->RecursionCount = 0;127 crit->OwningThread = 0;128 131 DosCloseEventSem(crit->hmtxLock); 129 crit->hmtxLock = 0; 130 crit->Reserved = (DWORD)-1; 132 if(DosInterlockedDecrement(&crit->CreationCount) == 0) 133 { 134 crit->LockCount = -1; 135 crit->RecursionCount = 0; 136 crit->OwningThread = 0; 137 crit->hmtxLock = 0; 138 crit->Reserved = (DWORD)-1; 139 } 131 140 } 132 141 return NO_ERROR;
Note:
See TracChangeset
for help on using the changeset viewer.
