Changeset 25707 in vbox for trunk/src/VBox/Runtime/generic
- Timestamp:
- Jan 11, 2010 10:02:03 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56444
- Location:
- trunk/src/VBox/Runtime/generic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/generic/semrw-generic.cpp
r25704 r25707 91 91 92 92 93 /* No debug wrapping here. */ 94 #undef RTSemRWRequestRead 95 #undef RTSemRWRequestReadNoResume 96 #undef RTSemRWRequestWrite 97 #undef RTSemRWRequestWriteNoResume 98 99 100 RTDECL(int) RTSemRWCreate(PRTSEMRW pRWSem) 101 { 93 94 #undef RTSemRWCreate 95 RTDECL(int) RTSemRWCreate(PRTSEMRW phRWSem) 96 { 97 return RTSemRWCreateEx(phRWSem, 0 /*fFlags*/, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemRW"); 98 } 99 RT_EXPORT_SYMBOL(RTSemRWCreate); 100 101 102 RTDECL(int) RTSemRWCreateEx(PRTSEMRW phRWSem, uint32_t fFlags, 103 RTLOCKVALCLASS hClass, uint32_t uSubClass, const char *pszNameFmt, ...) 104 { 105 AssertReturn(!(fFlags & ~RTSEMRW_FLAGS_NO_LOCK_VAL), VERR_INVALID_PARAMETER); 106 107 /* 108 * Allocate memory. 109 */ 102 110 int rc; 103 104 /*105 * Allocate memory.106 */107 111 struct RTSEMRWINTERNAL *pThis = (struct RTSEMRWINTERNAL *)RTMemAlloc(sizeof(struct RTSEMRWINTERNAL)); 108 112 if (pThis) … … 135 139 pThis->u32Magic = RTSEMRW_MAGIC; 136 140 #ifdef RTSEMRW_STRICT 137 RTLockValidatorRecExclInit(&pThis->ValidatorWrite, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, pThis, 138 true /*fEnabled*/, "RTSemRW"); 139 RTLockValidatorRecSharedInit(&pThis->ValidatorRead, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, pThis, 140 false /*fSignaller*/, true /*fEnabled*/, "RTSemEvent"); 141 bool const fLVEnabled = !(fFlags & RTSEMRW_FLAGS_NO_LOCK_VAL); 142 va_list va; 143 va_start(va, pszNameFmt); 144 RTLockValidatorRecExclInit(&pThis->ValidatorWrite, hClass, uSubClass, pThis, fLVEnabled, pszNameFmt); 145 va_end(va); 146 va_start(va, pszNameFmt); 147 RTLockValidatorRecSharedInit(&pThis->ValidatorRead, hClass, uSubClass, pThis, false /*fSignaller*/, 148 fLVEnabled, pszNameFmt); 149 va_end(va); 141 150 RTLockValidatorRecMakeSiblings(&pThis->ValidatorWrite.Core, &pThis->ValidatorRead.Core); 142 151 #endif 143 *p RWSem = pThis;152 *phRWSem = pThis; 144 153 return VINF_SUCCESS; 145 154 } … … 223 232 } 224 233 RT_EXPORT_SYMBOL(RTSemRWDestroy); 234 235 236 RTDECL(uint32_t) RTSemRWSetSubClass(RTSEMRW hRWSem, uint32_t uSubClass) 237 { 238 #ifdef RTSEMRW_STRICT 239 /* 240 * Validate handle. 241 */ 242 struct RTSEMRWINTERNAL *pThis = hRWSem; 243 AssertPtrReturn(pThis, RTLOCKVAL_SUB_CLASS_INVALID); 244 AssertReturn(pThis->u32Magic == RTSEMRW_MAGIC, RTLOCKVAL_SUB_CLASS_INVALID); 245 246 RTLockValidatorRecSharedSetSubClass(&pThis->ValidatorRead, uSubClass); 247 return RTLockValidatorRecExclSetSubClass(&pThis->ValidatorWrite, uSubClass); 248 #else 249 return RTLOCKVAL_SUB_CLASS_INVALID; 250 #endif 251 } 252 RT_EXPORT_SYMBOL(RTSemRWSetSubClass); 225 253 226 254 … … 395 423 396 424 425 #undef RTSemRWRequestRead 397 426 RTDECL(int) RTSemRWRequestRead(RTSEMRW RWSem, unsigned cMillies) 398 427 { … … 415 444 416 445 446 #undef RTSemRWRequestReadNoResume 417 447 RTDECL(int) RTSemRWRequestReadNoResume(RTSEMRW RWSem, unsigned cMillies) 418 448 { … … 699 729 700 730 731 #undef RTSemRWRequestWrite 701 732 RTDECL(int) RTSemRWRequestWrite(RTSEMRW RWSem, unsigned cMillies) 702 733 { … … 719 750 720 751 752 #undef RTSemRWRequestWriteNoResume 721 753 RTDECL(int) RTSemRWRequestWriteNoResume(RTSEMRW RWSem, unsigned cMillies) 722 754 { -
trunk/src/VBox/Runtime/generic/semrw-lockless-generic.cpp
r25704 r25707 113 113 114 114 115 115 #undef RTSemRWCreate 116 116 RTDECL(int) RTSemRWCreate(PRTSEMRW phRWSem) 117 117 { 118 return RTSemRWCreateEx(phRWSem, 0 /*fFlags*/, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemRW"); 119 } 120 RT_EXPORT_SYMBOL(RTSemRWCreate); 121 122 123 RTDECL(int) RTSemRWCreateEx(PRTSEMRW phRWSem, uint32_t fFlags, 124 RTLOCKVALCLASS hClass, uint32_t uSubClass, const char *pszNameFmt, ...) 125 { 126 AssertReturn(!(fFlags & ~RTSEMRW_FLAGS_NO_LOCK_VAL), VERR_INVALID_PARAMETER); 127 118 128 RTSEMRWINTERNAL *pThis = (RTSEMRWINTERNAL *)RTMemAlloc(sizeof(*pThis)); 119 129 if (!pThis) … … 134 144 pThis->fNeedReset = false; 135 145 #ifdef RTSEMRW_STRICT 136 RTLockValidatorRecExclInit(&pThis->ValidatorWrite, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, pThis, 137 true /*fEnabled*/, "RTSemRW"); 138 RTLockValidatorRecSharedInit(&pThis->ValidatorRead, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, pThis, 139 false /*fSignaller*/, true /*fEnabled*/, "RTSemEvent"); 146 bool const fLVEnabled = !(fFlags & RTSEMRW_FLAGS_NO_LOCK_VAL); 147 va_list va; 148 va_start(va, pszNameFmt); 149 RTLockValidatorRecExclInit(&pThis->ValidatorWrite, hClass, uSubClass, pThis, fLVEnabled, pszNameFmt); 150 va_end(va); 151 va_start(va, pszNameFmt); 152 RTLockValidatorRecSharedInit(&pThis->ValidatorRead, hClass, uSubClass, pThis, false /*fSignaller*/, 153 fLVEnabled, pszNameFmt); 154 va_end(va); 140 155 RTLockValidatorRecMakeSiblings(&pThis->ValidatorWrite.Core, &pThis->ValidatorRead.Core); 141 156 #endif … … 148 163 return rc; 149 164 } 165 RT_EXPORT_SYMBOL(RTSemRWCreateEx); 150 166 151 167 … … 184 200 return VINF_SUCCESS; 185 201 } 202 RT_EXPORT_SYMBOL(RTSemRWDestroy); 203 204 205 RTDECL(uint32_t) RTSemRWSetSubClass(RTSEMRW hRWSem, uint32_t uSubClass) 206 { 207 #ifdef RTSEMRW_STRICT 208 /* 209 * Validate handle. 210 */ 211 struct RTSEMRWINTERNAL *pThis = hRWSem; 212 AssertPtrReturn(pThis, RTLOCKVAL_SUB_CLASS_INVALID); 213 AssertReturn(pThis->u32Magic == RTSEMRW_MAGIC, RTLOCKVAL_SUB_CLASS_INVALID); 214 215 RTLockValidatorRecSharedSetSubClass(&pThis->ValidatorRead, uSubClass); 216 return RTLockValidatorRecExclSetSubClass(&pThis->ValidatorWrite, uSubClass); 217 #else 218 return RTLOCKVAL_SUB_CLASS_INVALID; 219 #endif 220 } 221 RT_EXPORT_SYMBOL(RTSemRWSetSubClass); 186 222 187 223
Note:
See TracChangeset
for help on using the changeset viewer.