Changeset 27511 in vbox for trunk/src/VBox
- Timestamp:
- Mar 19, 2010 1:37:26 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/win/pipe-win.cpp
r27509 r27511 78 78 /** Set if we've promised that the handle is writable. */ 79 79 bool fPromisedWritable; 80 /** The number of users of the current mode. */81 uint32_t c ModeUsers;80 /** Usage counter. */ 81 uint32_t cUsers; 82 82 /** The overlapped I/O structure we use. */ 83 83 OVERLAPPED Overlapped; … … 91 91 * We can only have one poller at the time (lazy bird). */ 92 92 RTPOLLSET hPollSet; 93 /** The number of references to the handle in hPollSet. */94 uint32_t cPolls;95 93 /** Critical section protecting the above members. 96 94 * (Taking the lazy/simple approach.) */ … … 289 287 //pThisW->fPromisedWritable= false; 290 288 //pThisR->fPromisedWritable= false; 291 //pThisR->c ModeUsers= 0;292 //pThisW->c ModeUsers= 0;289 //pThisR->cUsers = 0; 290 //pThisW->cUsers = 0; 293 291 //pThisR->pbBounceBuf = NULL; 294 292 //pThisW->pbBounceBuf = NULL; … … 299 297 pThisR->hPollSet = NIL_RTPOLLSET; 300 298 pThisW->hPollSet = NIL_RTPOLLSET; 301 //pThisW->cPolls = 0;302 //pThisR->cPolls = 0;303 299 304 300 *phPipeRead = pThisR; … … 410 406 AssertReturn(ASMAtomicCmpXchgU32(&pThis->u32Magic, ~RTPIPE_MAGIC, RTPIPE_MAGIC), VERR_INVALID_HANDLE); 411 407 RTCritSectEnter(&pThis->CritSect); 412 Assert(pThis->c ModeUsers == 0);408 Assert(pThis->cUsers == 0); 413 409 414 410 if (!pThis->fRead && pThis->fIOPending) … … 456 452 { 457 453 /* No concurrent readers, sorry. */ 458 if (pThis->c ModeUsers == 0)459 { 460 pThis->c ModeUsers++;454 if (pThis->cUsers == 0) 455 { 456 pThis->cUsers++; 461 457 462 458 /* … … 503 499 pThis->fBrokenPipe = true; 504 500 505 pThis->c ModeUsers--;501 pThis->cUsers--; 506 502 } 507 503 else … … 525 521 { 526 522 /* No concurrent readers, sorry. */ 527 if (pThis->c ModeUsers == 0)528 { 529 pThis->c ModeUsers++;523 if (pThis->cUsers == 0) 524 { 525 pThis->cUsers++; 530 526 531 527 size_t cbTotalRead = 0; … … 580 576 } 581 577 582 pThis->c ModeUsers--;578 pThis->cUsers--; 583 579 } 584 580 else … … 603 599 { 604 600 /* No concurrent readers, sorry. */ 605 if (pThis->c ModeUsers == 0)606 { 607 pThis->c ModeUsers++;601 if (pThis->cUsers == 0) 602 { 603 pThis->cUsers++; 608 604 609 605 /* If I/O is pending, check if it has completed. */ … … 687 683 pThis->fBrokenPipe = true; 688 684 689 pThis->c ModeUsers--;685 pThis->cUsers--; 690 686 } 691 687 else … … 710 706 { 711 707 /* No concurrent readers, sorry. */ 712 if (pThis->c ModeUsers == 0)713 { 714 pThis->c ModeUsers++;708 if (pThis->cUsers == 0) 709 { 710 pThis->cUsers++; 715 711 716 712 /* … … 736 732 /* 737 733 * Try write everything. 738 * No bounce buffering, c ModeUsers protects us.734 * No bounce buffering, cUsers protects us. 739 735 */ 740 736 size_t cbTotalWritten = 0; … … 787 783 pThis->fBrokenPipe = true; 788 784 789 pThis->c ModeUsers--;785 pThis->cUsers--; 790 786 } 791 787 else … … 886 882 break; 887 883 } 888 AssertBreakStmt(pThis->c ModeUsers == 0, rc = VERR_INTERNAL_ERROR_5);884 AssertBreakStmt(pThis->cUsers == 0, rc = VERR_INTERNAL_ERROR_5); 889 885 rc = ResetEvent(pThis->Overlapped.hEvent); Assert(rc == TRUE); 890 886 DWORD cbRead = 0; … … 897 893 else if (GetLastError() == ERROR_IO_PENDING) 898 894 { 899 pThis->c ModeUsers++;895 pThis->cUsers++; 900 896 pThis->fIOPending = true; 901 897 pThis->fZeroByteRead = true; … … 997 993 if (pThis->fZeroByteRead) 998 994 { 999 pThis->c ModeUsers--;995 pThis->cUsers--; 1000 996 pThis->fIOPending = false; 1001 997 if (rc != VINF_SUCCESS) … … 1144 1140 /* Check that this is the only current use of this pipe. */ 1145 1141 uint32_t fRetEvents; 1146 if ( ( pThis->cPolls == 0 1147 && pThis->cModeUsers == 0) 1148 || pThis->hPollSet == hPollSet 1149 ) 1142 if ( pThis->cUsers == 0 1143 || pThis->hPollSet == hPollSet) 1150 1144 { 1151 1145 /* Check what the current events are. */ … … 1183 1177 if (!fRetEvents) 1184 1178 { 1185 pThis->cPolls++; 1186 pThis->cModeUsers++; 1179 pThis->cUsers++; 1187 1180 pThis->hPollSet = hPollSet; 1188 1181 } … … 1224 1217 AssertRCReturn(rc, 0); 1225 1218 1226 Assert(pThis->cPolls > 0); 1227 Assert(pThis->cModeUsers > 0); 1219 Assert(pThis->cUsers > 0); 1228 1220 1229 1221 … … 1246 1238 1247 1239 /* update counters. */ 1248 pThis->c Polls--;1249 if (!pThis->c Polls)1240 pThis->cUsers--; 1241 if (!pThis->cUsers) 1250 1242 pThis->hPollSet = NIL_RTPOLLSET; 1251 pThis->cModeUsers--;1252 1243 1253 1244 RTCritSectLeave(&pThis->CritSect);
Note:
See TracChangeset
for help on using the changeset viewer.