- Timestamp:
- Dec 10, 2001, 1:55:13 PM (24 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/hmcomm.cpp
r7596 r7604 1 /* $Id: hmcomm.cpp,v 1.3 2 2001-12-09 21:19:28sandervl Exp $ */1 /* $Id: hmcomm.cpp,v 1.33 2001-12-10 12:55:12 sandervl Exp $ */ 2 2 3 3 /* … … 238 238 comnr = comname[3] - '1'; 239 239 240 if(handler[comnr] == NULL) { 240 if(handler[comnr] == NULL) 241 { 241 242 try { 242 243 handler[comnr] = new OverlappedIOHandler(CommReadIOHandler, CommWriteIOHandler, CommPollIOHandler); … … 272 273 * Author : SvL 273 274 *****************************************************************************/ 274 275 275 DWORD HMDeviceCommClass::GetFileType(PHMHANDLEDATA pHMHandleData) 276 276 { … … 421 421 dwEvent |= (COMEvt&0x0080)? EV_ERR:0; 422 422 dwEvent |= (COMEvt&0x0100)? EV_RING:0; 423 424 if((dwEvent & EV_RXCHAR) && (dwMask & EV_RXCHAR)) 425 { 426 //check if there's really data in the in queue 427 RXQUEUE qInfo; 428 ULONG ulLen = sizeof(qInfo); 429 ULONG rc = OSLibDosDevIOCtl(pHMHandleData->hHMHandle, 430 IOCTL_ASYNC, 431 ASYNC_GETINQUECOUNT, 432 0,0,0, 433 &qInfo,ulLen,&ulLen); 434 if(qInfo.cch == 0) { 435 dprintf(("!WARNING!: CommPollIOHandler -> EV_RXCHAR but no DATA")); 436 dwEvent &= ~EV_RXCHAR; 437 } 438 } 423 439 if((dwEvent & dwMask)) { 424 440 dprintf(("CommPollIOHandler: event(s) %x occured", (dwEvent & dwMask))); … … 726 742 PHMDEVCOMDATA pDevData = (PHMDEVCOMDATA)pHMHandleData->lpHandlerData; 727 743 728 dprintf(("KERNEL32- WARNING: HMDeviceCommClass::GetOverlappedResult(%08xh,%08xh,%08xh,%08xh)",744 dprintf(("KERNEL32-HMDeviceCommClass: HMDeviceCommClass::GetOverlappedResult(%08xh,%08xh,%08xh,%08xh)", 729 745 pHMHandleData->hHMHandle, lpOverlapped, lpcbTransfer, fWait)); 730 746 -
trunk/src/kernel32/overlappedio.cpp
r7603 r7604 1 /* $Id: overlappedio.cpp,v 1.1 0 2001-12-10 11:29:01sandervl Exp $ */1 /* $Id: overlappedio.cpp,v 1.11 2001-12-10 12:55:12 sandervl Exp $ */ 2 2 3 3 /* … … 55 55 dprintf(("OverlappedIOThread: hEventRead %x hEventWrite %x hEventPoll %x", hEventRead, hEventWrite, hEventPoll)); 56 56 57 //the exit event semaphore is manual reset, because this event57 //the exit & cancel event semaphores are manual reset, because these events 58 58 //must be able to wake up multiple threads 59 59 hEventExit = ::CreateEventA(NULL, TRUE, FALSE, NULL); 60 if(!hEventPoll || !hEventRead || !hEventWrite || !hEventExit) 60 hEventCancel = ::CreateEventA(NULL, TRUE, FALSE, NULL); 61 if(!hEventPoll || !hEventRead || !hEventWrite || !hEventExit || !hEventCancel) 61 62 { 62 63 DebugInt3(); … … 254 255 255 256 case ASYNCIO_POLL: 256 hEventsWait[0] = lpRequest->hEventCancel;257 hEventsWait[0] = hEventCancel; 257 258 hEventsWait[1] = hEventExit; 258 259 ret = WAIT_TIMEOUT; … … 349 350 ::LeaveCriticalSection(&critsect); 350 351 351 lpOverlapped->Internal = ERROR_IO_PENDING;352 lpOverlapped->Internal = STATUS_PENDING; 352 353 lpOverlapped->InternalHigh = 0; 353 354 lpOverlapped->Offset = 0; … … 407 408 ::LeaveCriticalSection(&critsect); 408 409 409 lpOverlapped->Internal = ERROR_IO_PENDING;410 lpOverlapped->Internal = STATUS_PENDING; 410 411 lpOverlapped->InternalHigh = 0; 411 412 lpOverlapped->Offset = 0; … … 459 460 lpRequest->next = NULL; 460 461 461 lpOverlapped->Internal = ERROR_IO_PENDING;462 lpOverlapped->Internal = STATUS_PENDING; 462 463 lpOverlapped->InternalHigh = 0; 463 464 lpOverlapped->Offset = 0; … … 509 510 for(int i=ASYNC_INDEX_READ;i<NR_ASYNC_OPERATIONS;i++) 510 511 { 511 while(TRUE) { 512 while(TRUE) 513 { 512 514 lpRequest = findAndRemoveRequest(i, hHandle); 513 515 514 516 if(lpRequest) { 515 ::SetEvent(lpRequest->hEventCancel); //cancel pending operation 517 //TODO: This doesn't work if multiple handles share the 518 // same OverlappedIOHandler 519 lpRequest->fCancelled = TRUE; 520 ::SetEvent(hEventCancel); //cancel pending operation 516 521 if(i != ASYNC_INDEX_BUSY) {//thread that handles the request will delete it 517 522 delete lpRequest; -
trunk/src/kernel32/overlappedio.h
r7598 r7604 1 /* $Id: overlappedio.h,v 1. 7 2001-12-09 21:55:17sandervl Exp $ */1 /* $Id: overlappedio.h,v 1.8 2001-12-10 12:55:13 sandervl Exp $ */ 2 2 3 3 /* … … 39 39 { 40 40 memset(this, 0, sizeof(ASYNCIOREQUEST)); 41 hEventCancel = ::CreateEventA(NULL, TRUE, FALSE, NULL);42 if(hEventCancel == 0) DebugInt3();43 };44 45 ~ASYNCIOREQUEST()46 {47 ::CloseHandle(hEventCancel);48 41 }; 49 42 … … 59 52 DWORD dwEventMask; 60 53 DWORD dwUserData; 61 HANDLE hEventCancel;54 BOOL fCancelled; 62 55 ASYNCIOREQUEST *next; 63 56 }; … … 124 117 HANDLE hThreadWrite; 125 118 HANDLE hEventExit; 119 HANDLE hEventCancel; 126 120 HANDLE hEventPoll; 127 121 HANDLE hEventRead;
Note:
See TracChangeset
for help on using the changeset viewer.