Changeset 25707 in vbox for trunk/src/VBox/Runtime/r3/posix
- Timestamp:
- Jan 11, 2010 10:02:03 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56444
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/semrw-posix.cpp
r25704 r25707 93 93 94 94 95 /* No debug wrapping here. */ 96 #undef RTSemRWRequestRead 97 #undef RTSemRWRequestReadNoResume 98 #undef RTSemRWRequestWrite 99 #undef RTSemRWRequestWriteNoResume 100 101 102 RTDECL(int) RTSemRWCreate(PRTSEMRW pRWSem) 103 { 95 96 #undef RTSemRWCreate 97 RTDECL(int) RTSemRWCreate(PRTSEMRW phRWSem) 98 { 99 return RTSemRWCreateEx(phRWSem, 0 /*fFlags*/, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemRW"); 100 } 101 102 103 RTDECL(int) RTSemRWCreateEx(PRTSEMRW phRWSem, uint32_t fFlags, 104 RTLOCKVALCLASS hClass, uint32_t uSubClass, const char *pszNameFmt, ...) 105 { 106 AssertReturn(!(fFlags & ~RTSEMRW_FLAGS_NO_LOCK_VAL), VERR_INVALID_PARAMETER); 107 108 /* 109 * Allocate handle. 110 */ 104 111 int rc; 105 106 /*107 * Allocate handle.108 */109 112 struct RTSEMRWINTERNAL *pThis = (struct RTSEMRWINTERNAL *)RTMemAlloc(sizeof(struct RTSEMRWINTERNAL)); 110 113 if (pThis) … … 126 129 pThis->Writer = (pthread_t)-1; 127 130 #ifdef RTSEMRW_STRICT 128 RTLockValidatorRecExclInit(&pThis->ValidatorWrite, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, pThis, 129 true /*fEnabled*/, "RTSemRW"); 130 RTLockValidatorRecSharedInit(&pThis->ValidatorRead, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, pThis, 131 false /*fSignaller*/, true /*fEnabled*/, "RTSemEvent"); 131 bool const fLVEnabled = !(fFlags & RTSEMRW_FLAGS_NO_LOCK_VAL); 132 va_list va; 133 va_start(va, pszNameFmt); 134 RTLockValidatorRecExclInit(&pThis->ValidatorWrite, hClass, uSubClass, pThis, fLVEnabled, pszNameFmt); 135 va_end(va); 136 va_start(va, pszNameFmt); 137 RTLockValidatorRecSharedInit(&pThis->ValidatorRead, hClass, uSubClass, pThis, false /*fSignaller*/, 138 fLVEnabled, pszNameFmt); 139 va_end(va); 132 140 RTLockValidatorRecMakeSiblings(&pThis->ValidatorWrite.Core, &pThis->ValidatorRead.Core); 133 141 #endif 134 *p RWSem = pThis;142 *phRWSem = pThis; 135 143 return VINF_SUCCESS; 136 144 } … … 186 194 187 195 return rc; 196 } 197 198 199 RTDECL(uint32_t) RTSemRWSetSubClass(RTSEMRW hRWSem, uint32_t uSubClass) 200 { 201 #ifdef RTSEMRW_STRICT 202 /* 203 * Validate handle. 204 */ 205 struct RTSEMRWINTERNAL *pThis = hRWSem; 206 AssertPtrReturn(pThis, RTLOCKVAL_SUB_CLASS_INVALID); 207 AssertReturn(pThis->u32Magic == RTSEMRW_MAGIC, RTLOCKVAL_SUB_CLASS_INVALID); 208 209 RTLockValidatorRecSharedSetSubClass(&pThis->ValidatorRead, uSubClass); 210 return RTLockValidatorRecExclSetSubClass(&pThis->ValidatorWrite, uSubClass); 211 #else 212 return RTLOCKVAL_SUB_CLASS_INVALID; 213 #endif 188 214 } 189 215 … … 289 315 290 316 317 #undef RTSemRWRequestRead 291 318 RTDECL(int) RTSemRWRequestRead(RTSEMRW RWSem, unsigned cMillies) 292 319 { … … 307 334 308 335 336 #undef RTSemRWRequestReadNoResume 309 337 RTDECL(int) RTSemRWRequestReadNoResume(RTSEMRW RWSem, unsigned cMillies) 310 338 { … … 483 511 484 512 513 #undef RTSemRWRequestWrite 485 514 RTDECL(int) RTSemRWRequestWrite(RTSEMRW RWSem, unsigned cMillies) 486 515 { … … 501 530 502 531 532 #undef RTSemRWRequestWriteNoResume 503 533 RTDECL(int) RTSemRWRequestWriteNoResume(RTSEMRW RWSem, unsigned cMillies) 504 534 {
Note:
See TracChangeset
for help on using the changeset viewer.