Changeset 36015 in vbox for trunk/src/VBox
- Timestamp:
- Feb 17, 2011 3:10:32 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/ApplianceImplIO.cpp
r35368 r36015 93 93 ******************************************************************************/ 94 94 95 #define STATUS_WAIT UINT32_C(0) 96 #define STATUS_WRITE UINT32_C(1) 97 #define STATUS_READ UINT32_C(2) 98 #define STATUS_END UINT32_C(3) 95 #define STATUS_WAIT UINT32_C(0) 96 #define STATUS_WRITE UINT32_C(1) 97 #define STATUS_WRITING UINT32_C(2) 98 #define STATUS_READ UINT32_C(3) 99 #define STATUS_READING UINT32_C(4) 100 #define STATUS_END UINT32_C(5) 99 101 100 102 /* Enable for getting some flow history. */ … … 491 493 case STATUS_WRITE: 492 494 { 495 ASMAtomicCmpXchgU32(&pInt->u32Status, STATUS_WRITING, STATUS_WRITE); 493 496 size_t cbAvail = RTCircBufUsed(pInt->pCircBuf); 494 497 size_t cbMemAllRead = 0; … … 536 539 * are finished. Use CmpXchg, so we not overwrite other states 537 540 * which could be signaled in the meantime. */ 538 ASMAtomicCmpXchgU32(&pInt->u32Status, STATUS_WAIT, STATUS_WRITE);539 rc = RTSemEventSignal(pInt->workFinishedEvent);541 if (ASMAtomicCmpXchgU32(&pInt->u32Status, STATUS_WAIT, STATUS_WRITING)) 542 rc = RTSemEventSignal(pInt->workFinishedEvent); 540 543 break; 541 544 } 542 545 case STATUS_READ: 543 546 { 547 ASMAtomicCmpXchgU32(&pInt->u32Status, STATUS_READING, STATUS_READ); 544 548 size_t cbAvail = RTCircBufFree(pInt->pCircBuf); 545 549 size_t cbMemAllWrite = 0; … … 594 598 * are finished. Use CmpXchg, so we not overwrite other states 595 599 * which could be signaled in the meantime. */ 596 ASMAtomicCmpXchgU32(&pInt->u32Status, STATUS_WAIT, STATUS_READ);597 rc = RTSemEventSignal(pInt->workFinishedEvent);600 if (ASMAtomicCmpXchgU32(&pInt->u32Status, STATUS_WAIT, STATUS_READING)) 601 rc = RTSemEventSignal(pInt->workFinishedEvent); 598 602 break; 599 603 } … … 606 610 } 607 611 } 612 /* Cleanup any status changes to indicate we are finished. */ 613 ASMAtomicWriteU32(&pInt->u32Status, STATUS_END); 614 rc = RTSemEventSignal(pInt->workFinishedEvent); 608 615 return rc; 609 616 } … … 623 630 // RTPrintf(" wait\n"); 624 631 if (!( ASMAtomicReadU32(&pInt->u32Status) == STATUS_WRITE 625 || ASMAtomicReadU32(&pInt->u32Status) == STATUS_READ)) 632 || ASMAtomicReadU32(&pInt->u32Status) == STATUS_WRITING 633 || ASMAtomicReadU32(&pInt->u32Status) == STATUS_READ 634 || ASMAtomicReadU32(&pInt->u32Status) == STATUS_READING)) 626 635 break; 627 636 rc = RTSemEventWait(pInt->workFinishedEvent, 100); … … 678 687 pInt->fEOF = false; 679 688 pInt->fOpenMode = fOpen; 689 pInt->u32Status = STATUS_WAIT; 680 690 681 691 /* Circular buffer in the read case. */
Note:
See TracChangeset
for help on using the changeset viewer.