- Timestamp:
- May 7, 2008 12:31:30 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/semaphore.h
r8245 r8653 338 338 */ 339 339 RTDECL(int) RTSemRWReleaseWrite(RTSEMRW RWSem); 340 341 /** 342 * Checks if the caller is the exclusive semaphore owner. 343 * 344 * @returns true / false accoringly. 345 * @param RWSem The Read/Write semaphore in question. 346 */ 347 RTDECL(bool) RTSemRWIsWriteOwner(RTSEMRW RWSem); 348 349 /** 350 * Gets the write recursion count. 351 * 352 * @returns The write recursion count (0 if bad semaphore handle). 353 * @param RWSem The Read/Write semaphore in question. 354 */ 355 RTDECL(uint32_t) RTSemRWGetWriteRecursion(RTSEMRW RWSem); 356 357 /** 358 * Gets the read recursion count of the current writer. 359 * 360 * @returns The read recursion count (0 if bad semaphore handle). 361 * @param RWSem The Read/Write semaphore in question. 362 */ 363 RTDECL(uint32_t) RTSemRWGetWriterReadRecursion(RTSEMRW RWSem); 340 364 341 365 -
trunk/src/VBox/Runtime/r3/posix/semrw-posix.cpp
r8652 r8653 430 430 } 431 431 432 433 RTDECL(bool) RTSemRWIsWriteOwner(RTSEMRW RWSem) 434 { 435 /* 436 * Validate input. 437 */ 438 struct RTSEMRWINTERNAL *pThis = RWSem; 439 AssertPtrReturn(pThis, false); 440 AssertMsgReturn(pThis->u32Magic == RTSEMRW_MAGIC, 441 ("pThis=%p u32Magic=%#x\n", pThis, pThis->u32Magic), 442 false); 443 444 /* 445 * Check ownership. 446 */ 447 pthread_t Self = pthread_self(); 448 pthread_t Writer; 449 ATOMIC_GET_PTHREAD_T(&pThis->Writer, &Writer); 450 return Writer == Self; 451 } 452 453 454 RTDECL(uint32_t) RTSemRWGetWriteRecursion(RTSEMRW RWSem) 455 { 456 /* 457 * Validate input. 458 */ 459 struct RTSEMRWINTERNAL *pThis = RWSem; 460 AssertPtrReturn(pThis, 0); 461 AssertMsgReturn(pThis->u32Magic == RTSEMRW_MAGIC, 462 ("pThis=%p u32Magic=%#x\n", pThis, pThis->u32Magic), 463 0); 464 465 /* 466 * Return the requested data. 467 */ 468 return pThis->cWrites; 469 } 470 471 472 RTDECL(uint32_t) RTSemRWGetWriterReadRecursion(RTSEMRW RWSem) 473 { 474 /* 475 * Validate input. 476 */ 477 struct RTSEMRWINTERNAL *pThis = RWSem; 478 AssertPtrReturn(pThis, 0); 479 AssertMsgReturn(pThis->u32Magic == RTSEMRW_MAGIC, 480 ("pThis=%p u32Magic=%#x\n", pThis, pThis->u32Magic), 481 0); 482 483 /* 484 * Return the requested data. 485 */ 486 return pThis->cWriterReads; 487 }
Note:
See TracChangeset
for help on using the changeset viewer.