Changeset 8652 in vbox for trunk/src/VBox/Runtime/r3/posix
- Timestamp:
- May 7, 2008 12:22:39 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/semrw-posix.cpp
r8245 r8652 35 35 #include <iprt/assert.h> 36 36 #include <iprt/alloc.h> 37 #include <iprt/thread.h> 37 38 #include <iprt/asm.h> 38 39 #include <iprt/err.h> … … 44 45 45 46 #include "internal/magics.h" 46 47 #include "internal/strict.h" 48 49 50 /******************************************************************************* 51 * Defined Constants And Macros * 52 *******************************************************************************/ 47 53 /** @todo move this to r3/posix/something.h. */ 48 54 #ifdef RT_OS_SOLARIS … … 167 173 * Check if it's the writer (implement write+read recursion). 168 174 */ 175 #ifdef RTSEMRW_STRICT 176 RTTHREAD ThreadSelf = RTThreadSelf(); 177 #endif 169 178 pthread_t Self = pthread_self(); 170 179 pthread_t Writer; … … 174 183 Assert(pThis->cWriterReads < INT32_MAX); 175 184 pThis->cWriterReads++; 185 #ifdef RTSEMRW_STRICT 186 if (ThreadSelf != NIL_RTTHREAD) 187 RTThreadReadLockInc(ThreadSelf); 188 #endif 176 189 return VINF_SUCCESS; 177 190 } … … 223 236 } 224 237 238 #ifdef RTSEMRW_STRICT 239 if (ThreadSelf != NIL_RTTHREAD) 240 RTThreadReadLockInc(ThreadSelf); 241 #endif 225 242 return VINF_SUCCESS; 226 243 } … … 248 265 * Check if it's the writer. 249 266 */ 267 #ifdef RTSEMRW_STRICT 268 RTTHREAD ThreadSelf = RTThreadSelf(); 269 #endif 250 270 pthread_t Self = pthread_self(); 251 271 pthread_t Writer; … … 256 276 ("pThis=%p\n", pThis), VERR_NOT_OWNER); 257 277 pThis->cWriterReads--; 278 #ifdef RTSEMRW_STRICT 279 if (ThreadSelf != NIL_RTTHREAD) 280 RTThreadReadLockDec(ThreadSelf); 281 #endif 258 282 return VINF_SUCCESS; 259 283 } … … 269 293 } 270 294 295 #ifdef RTSEMRW_STRICT 296 if (ThreadSelf != NIL_RTTHREAD) 297 RTThreadReadLockDec(ThreadSelf); 298 #endif 271 299 return VINF_SUCCESS; 272 300 } … … 344 372 ATOMIC_SET_PTHREAD_T(&pThis->Writer, Self); 345 373 pThis->cWrites = 1; 374 #ifdef RTSEMRW_STRICT 375 RTTHREAD ThreadSelf = RTThreadSelf(); 376 if (ThreadSelf != NIL_RTTHREAD) 377 RTThreadWriteLockInc(ThreadSelf); 378 #endif 346 379 return VINF_SUCCESS; 347 380 } … … 389 422 } 390 423 424 #ifdef RTSEMRW_STRICT 425 RTTHREAD ThreadSelf = RTThreadSelf(); 426 if (ThreadSelf != NIL_RTTHREAD) 427 RTThreadWriteLockDec(ThreadSelf); 428 #endif 391 429 return VINF_SUCCESS; 392 430 }
Note:
See TracChangeset
for help on using the changeset viewer.