Changeset 25723 in vbox for trunk/src/VBox/Runtime/r3
- Timestamp:
- Jan 11, 2010 2:28:57 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/semrw-posix.cpp
r25710 r25723 155 155 156 156 157 RTDECL(int) RTSemRWDestroy(RTSEMRW RWSem)157 RTDECL(int) RTSemRWDestroy(RTSEMRW hRWSem) 158 158 { 159 159 /* 160 160 * Validate input, nil handle is fine. 161 161 */ 162 struct RTSEMRWINTERNAL *pThis = RWSem;162 struct RTSEMRWINTERNAL *pThis = hRWSem; 163 163 if (pThis == NIL_RTSEMRW) 164 164 return VINF_SUCCESS; … … 189 189 { 190 190 ASMAtomicWriteU32(&pThis->u32Magic, RTSEMRW_MAGIC); 191 AssertMsgFailed(("Failed to destroy read-write sem %p, rc=%d.\n", RWSem, rc));191 AssertMsgFailed(("Failed to destroy read-write sem %p, rc=%d.\n", hRWSem, rc)); 192 192 rc = RTErrConvertFromErrno(rc); 193 193 } … … 215 215 216 216 217 DECL_FORCE_INLINE(int) rtSemRWRequestRead(RTSEMRW RWSem, unsignedcMillies, PCRTLOCKVALSRCPOS pSrcPos)218 { 219 /* 220 * Validate input. 221 */ 222 struct RTSEMRWINTERNAL *pThis = RWSem;217 DECL_FORCE_INLINE(int) rtSemRWRequestRead(RTSEMRW hRWSem, RTMSINTERVAL cMillies, PCRTLOCKVALSRCPOS pSrcPos) 218 { 219 /* 220 * Validate input. 221 */ 222 struct RTSEMRWINTERNAL *pThis = hRWSem; 223 223 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 224 224 AssertMsgReturn(pThis->u32Magic == RTSEMRW_MAGIC, … … 269 269 if (rc) 270 270 { 271 AssertMsgFailed(("Failed read lock read-write sem %p, rc=%d.\n", RWSem, rc));271 AssertMsgFailed(("Failed read lock read-write sem %p, rc=%d.\n", hRWSem, rc)); 272 272 return RTErrConvertFromErrno(rc); 273 273 } … … 301 301 if (rc) 302 302 { 303 AssertMsg(rc == ETIMEDOUT, ("Failed read lock read-write sem %p, rc=%d.\n", RWSem, rc));303 AssertMsg(rc == ETIMEDOUT, ("Failed read lock read-write sem %p, rc=%d.\n", hRWSem, rc)); 304 304 return RTErrConvertFromErrno(rc); 305 305 } … … 316 316 317 317 #undef RTSemRWRequestRead 318 RTDECL(int) RTSemRWRequestRead(RTSEMRW RWSem, unsignedcMillies)318 RTDECL(int) RTSemRWRequestRead(RTSEMRW hRWSem, RTMSINTERVAL cMillies) 319 319 { 320 320 #ifndef RTSEMRW_STRICT 321 return rtSemRWRequestRead( RWSem, cMillies, NULL);321 return rtSemRWRequestRead(hRWSem, cMillies, NULL); 322 322 #else 323 323 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API(); 324 return rtSemRWRequestRead( RWSem, cMillies, &SrcPos);325 #endif 326 } 327 328 329 RTDECL(int) RTSemRWRequestReadDebug(RTSEMRW RWSem, unsignedcMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)324 return rtSemRWRequestRead(hRWSem, cMillies, &SrcPos); 325 #endif 326 } 327 328 329 RTDECL(int) RTSemRWRequestReadDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL) 330 330 { 331 331 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API(); 332 return rtSemRWRequestRead( RWSem, cMillies, &SrcPos);332 return rtSemRWRequestRead(hRWSem, cMillies, &SrcPos); 333 333 } 334 334 335 335 336 336 #undef RTSemRWRequestReadNoResume 337 RTDECL(int) RTSemRWRequestReadNoResume(RTSEMRW RWSem, unsignedcMillies)337 RTDECL(int) RTSemRWRequestReadNoResume(RTSEMRW hRWSem, RTMSINTERVAL cMillies) 338 338 { 339 339 /* EINTR isn't returned by the wait functions we're using. */ 340 340 #ifndef RTSEMRW_STRICT 341 return rtSemRWRequestRead( RWSem, cMillies, NULL);341 return rtSemRWRequestRead(hRWSem, cMillies, NULL); 342 342 #else 343 343 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API(); 344 return rtSemRWRequestRead( RWSem, cMillies, &SrcPos);345 #endif 346 } 347 348 349 RTDECL(int) RTSemRWRequestReadNoResumeDebug(RTSEMRW RWSem, unsignedcMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)344 return rtSemRWRequestRead(hRWSem, cMillies, &SrcPos); 345 #endif 346 } 347 348 349 RTDECL(int) RTSemRWRequestReadNoResumeDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL) 350 350 { 351 351 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API(); 352 return rtSemRWRequestRead( RWSem, cMillies, &SrcPos);353 } 354 355 356 RTDECL(int) RTSemRWReleaseRead(RTSEMRW RWSem)357 { 358 /* 359 * Validate input. 360 */ 361 struct RTSEMRWINTERNAL *pThis = RWSem;352 return rtSemRWRequestRead(hRWSem, cMillies, &SrcPos); 353 } 354 355 356 RTDECL(int) RTSemRWReleaseRead(RTSEMRW hRWSem) 357 { 358 /* 359 * Validate input. 360 */ 361 struct RTSEMRWINTERNAL *pThis = hRWSem; 362 362 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 363 363 AssertMsgReturn(pThis->u32Magic == RTSEMRW_MAGIC, … … 403 403 { 404 404 ASMAtomicIncU32(&pThis->cReaders); 405 AssertMsgFailed(("Failed read unlock read-write sem %p, rc=%d.\n", RWSem, rc));405 AssertMsgFailed(("Failed read unlock read-write sem %p, rc=%d.\n", hRWSem, rc)); 406 406 return RTErrConvertFromErrno(rc); 407 407 } … … 410 410 411 411 412 DECL_FORCE_INLINE(int) rtSemRWRequestWrite(RTSEMRW RWSem, unsignedcMillies, PCRTLOCKVALSRCPOS pSrcPos)413 { 414 /* 415 * Validate input. 416 */ 417 struct RTSEMRWINTERNAL *pThis = RWSem;412 DECL_FORCE_INLINE(int) rtSemRWRequestWrite(RTSEMRW hRWSem, RTMSINTERVAL cMillies, PCRTLOCKVALSRCPOS pSrcPos) 413 { 414 /* 415 * Validate input. 416 */ 417 struct RTSEMRWINTERNAL *pThis = hRWSem; 418 418 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 419 419 AssertMsgReturn(pThis->u32Magic == RTSEMRW_MAGIC, … … 464 464 if (rc) 465 465 { 466 AssertMsgFailed(("Failed write lock read-write sem %p, rc=%d.\n", RWSem, rc));466 AssertMsgFailed(("Failed write lock read-write sem %p, rc=%d.\n", hRWSem, rc)); 467 467 return RTErrConvertFromErrno(rc); 468 468 } … … 495 495 if (rc) 496 496 { 497 AssertMsg(rc == ETIMEDOUT, ("Failed read lock read-write sem %p, rc=%d.\n", RWSem, rc));497 AssertMsg(rc == ETIMEDOUT, ("Failed read lock read-write sem %p, rc=%d.\n", hRWSem, rc)); 498 498 return RTErrConvertFromErrno(rc); 499 499 } … … 512 512 513 513 #undef RTSemRWRequestWrite 514 RTDECL(int) RTSemRWRequestWrite(RTSEMRW RWSem, unsignedcMillies)514 RTDECL(int) RTSemRWRequestWrite(RTSEMRW hRWSem, RTMSINTERVAL cMillies) 515 515 { 516 516 #ifndef RTSEMRW_STRICT 517 return rtSemRWRequestWrite( RWSem, cMillies, NULL);517 return rtSemRWRequestWrite(hRWSem, cMillies, NULL); 518 518 #else 519 519 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API(); 520 return rtSemRWRequestWrite( RWSem, cMillies, &SrcPos);521 #endif 522 } 523 524 525 RTDECL(int) RTSemRWRequestWriteDebug(RTSEMRW RWSem, unsignedcMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)520 return rtSemRWRequestWrite(hRWSem, cMillies, &SrcPos); 521 #endif 522 } 523 524 525 RTDECL(int) RTSemRWRequestWriteDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL) 526 526 { 527 527 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API(); 528 return rtSemRWRequestWrite( RWSem, cMillies, &SrcPos);528 return rtSemRWRequestWrite(hRWSem, cMillies, &SrcPos); 529 529 } 530 530 531 531 532 532 #undef RTSemRWRequestWriteNoResume 533 RTDECL(int) RTSemRWRequestWriteNoResume(RTSEMRW RWSem, unsignedcMillies)533 RTDECL(int) RTSemRWRequestWriteNoResume(RTSEMRW hRWSem, RTMSINTERVAL cMillies) 534 534 { 535 535 /* EINTR isn't returned by the wait functions we're using. */ 536 536 #ifndef RTSEMRW_STRICT 537 return rtSemRWRequestWrite( RWSem, cMillies, NULL);537 return rtSemRWRequestWrite(hRWSem, cMillies, NULL); 538 538 #else 539 539 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API(); 540 return rtSemRWRequestWrite( RWSem, cMillies, &SrcPos);541 #endif 542 } 543 544 545 RTDECL(int) RTSemRWRequestWriteNoResumeDebug(RTSEMRW RWSem, unsignedcMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)540 return rtSemRWRequestWrite(hRWSem, cMillies, &SrcPos); 541 #endif 542 } 543 544 545 RTDECL(int) RTSemRWRequestWriteNoResumeDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL) 546 546 { 547 547 /* EINTR isn't returned by the wait functions we're using. */ 548 548 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API(); 549 return rtSemRWRequestWrite( RWSem, cMillies, &SrcPos);550 } 551 552 553 RTDECL(int) RTSemRWReleaseWrite(RTSEMRW RWSem)554 { 555 /* 556 * Validate input. 557 */ 558 struct RTSEMRWINTERNAL *pThis = RWSem;549 return rtSemRWRequestWrite(hRWSem, cMillies, &SrcPos); 550 } 551 552 553 RTDECL(int) RTSemRWReleaseWrite(RTSEMRW hRWSem) 554 { 555 /* 556 * Validate input. 557 */ 558 struct RTSEMRWINTERNAL *pThis = hRWSem; 559 559 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 560 560 AssertMsgReturn(pThis->u32Magic == RTSEMRW_MAGIC, … … 596 596 if (rc) 597 597 { 598 AssertMsgFailed(("Failed write unlock read-write sem %p, rc=%d.\n", RWSem, rc));598 AssertMsgFailed(("Failed write unlock read-write sem %p, rc=%d.\n", hRWSem, rc)); 599 599 return RTErrConvertFromErrno(rc); 600 600 } … … 604 604 605 605 606 RTDECL(bool) RTSemRWIsWriteOwner(RTSEMRW RWSem)607 { 608 /* 609 * Validate input. 610 */ 611 struct RTSEMRWINTERNAL *pThis = RWSem;606 RTDECL(bool) RTSemRWIsWriteOwner(RTSEMRW hRWSem) 607 { 608 /* 609 * Validate input. 610 */ 611 struct RTSEMRWINTERNAL *pThis = hRWSem; 612 612 AssertPtrReturn(pThis, false); 613 613 AssertMsgReturn(pThis->u32Magic == RTSEMRW_MAGIC, … … 625 625 626 626 627 RTDECL(uint32_t) RTSemRWGetWriteRecursion(RTSEMRW RWSem)628 { 629 /* 630 * Validate input. 631 */ 632 struct RTSEMRWINTERNAL *pThis = RWSem;627 RTDECL(uint32_t) RTSemRWGetWriteRecursion(RTSEMRW hRWSem) 628 { 629 /* 630 * Validate input. 631 */ 632 struct RTSEMRWINTERNAL *pThis = hRWSem; 633 633 AssertPtrReturn(pThis, 0); 634 634 AssertMsgReturn(pThis->u32Magic == RTSEMRW_MAGIC, … … 643 643 644 644 645 RTDECL(uint32_t) RTSemRWGetWriterReadRecursion(RTSEMRW RWSem)646 { 647 /* 648 * Validate input. 649 */ 650 struct RTSEMRWINTERNAL *pThis = RWSem;645 RTDECL(uint32_t) RTSemRWGetWriterReadRecursion(RTSEMRW hRWSem) 646 { 647 /* 648 * Validate input. 649 */ 650 struct RTSEMRWINTERNAL *pThis = hRWSem; 651 651 AssertPtrReturn(pThis, 0); 652 652 AssertMsgReturn(pThis->u32Magic == RTSEMRW_MAGIC, … … 661 661 662 662 663 RTDECL(uint32_t) RTSemRWGetReadCount(RTSEMRW RWSem)664 { 665 /* 666 * Validate input. 667 */ 668 struct RTSEMRWINTERNAL *pThis = RWSem;663 RTDECL(uint32_t) RTSemRWGetReadCount(RTSEMRW hRWSem) 664 { 665 /* 666 * Validate input. 667 */ 668 struct RTSEMRWINTERNAL *pThis = hRWSem; 669 669 AssertPtrReturn(pThis, 0); 670 670 AssertMsgReturn(pThis->u32Magic == RTSEMRW_MAGIC,
Note:
See TracChangeset
for help on using the changeset viewer.