Changeset 7604 for trunk/src


Ignore:
Timestamp:
Dec 10, 2001, 1:55:13 PM (24 years ago)
Author:
sandervl
Message:

overlapped io updates & fixes

Location:
trunk/src/kernel32
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/hmcomm.cpp

    r7596 r7604  
    1 /* $Id: hmcomm.cpp,v 1.32 2001-12-09 21:19:28 sandervl Exp $ */
     1/* $Id: hmcomm.cpp,v 1.33 2001-12-10 12:55:12 sandervl Exp $ */
    22
    33/*
     
    238238            comnr = comname[3] - '1';
    239239
    240             if(handler[comnr] == NULL) {
     240            if(handler[comnr] == NULL)
     241            {
    241242                try {
    242243                    handler[comnr] = new OverlappedIOHandler(CommReadIOHandler, CommWriteIOHandler, CommPollIOHandler);
     
    272273 * Author    : SvL
    273274 *****************************************************************************/
    274 
    275275DWORD HMDeviceCommClass::GetFileType(PHMHANDLEDATA pHMHandleData)
    276276{
     
    421421        dwEvent |= (COMEvt&0x0080)? EV_ERR:0;
    422422        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        }
    423439        if((dwEvent & dwMask)) {
    424440            dprintf(("CommPollIOHandler: event(s) %x occured", (dwEvent & dwMask)));
     
    726742  PHMDEVCOMDATA pDevData = (PHMDEVCOMDATA)pHMHandleData->lpHandlerData;
    727743
    728     dprintf(("KERNEL32-WARNING: HMDeviceCommClass::GetOverlappedResult(%08xh,%08xh,%08xh,%08xh)",
     744    dprintf(("KERNEL32-HMDeviceCommClass: HMDeviceCommClass::GetOverlappedResult(%08xh,%08xh,%08xh,%08xh)",
    729745             pHMHandleData->hHMHandle, lpOverlapped, lpcbTransfer, fWait));
    730746
  • trunk/src/kernel32/overlappedio.cpp

    r7603 r7604  
    1 /* $Id: overlappedio.cpp,v 1.10 2001-12-10 11:29:01 sandervl Exp $ */
     1/* $Id: overlappedio.cpp,v 1.11 2001-12-10 12:55:12 sandervl Exp $ */
    22
    33/*
     
    5555    dprintf(("OverlappedIOThread: hEventRead %x hEventWrite %x hEventPoll %x", hEventRead, hEventWrite, hEventPoll));
    5656
    57     //the exit event semaphore is manual reset, because this event
     57    //the exit & cancel event semaphores are manual reset, because these events
    5858    //must be able to wake up multiple threads
    5959    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)
    6162    {
    6263        DebugInt3();
     
    254255
    255256            case ASYNCIO_POLL:
    256                 hEventsWait[0] = lpRequest->hEventCancel;
     257                hEventsWait[0] = hEventCancel;
    257258                hEventsWait[1] = hEventExit;
    258259                ret = WAIT_TIMEOUT;
     
    349350    ::LeaveCriticalSection(&critsect);
    350351
    351     lpOverlapped->Internal     = ERROR_IO_PENDING;
     352    lpOverlapped->Internal     = STATUS_PENDING;
    352353    lpOverlapped->InternalHigh = 0;
    353354    lpOverlapped->Offset       = 0;
     
    407408    ::LeaveCriticalSection(&critsect);
    408409
    409     lpOverlapped->Internal     = ERROR_IO_PENDING;
     410    lpOverlapped->Internal     = STATUS_PENDING;
    410411    lpOverlapped->InternalHigh = 0;
    411412    lpOverlapped->Offset       = 0;
     
    459460    lpRequest->next                = NULL;
    460461
    461     lpOverlapped->Internal     = ERROR_IO_PENDING;
     462    lpOverlapped->Internal     = STATUS_PENDING;
    462463    lpOverlapped->InternalHigh = 0;
    463464    lpOverlapped->Offset       = 0;
     
    509510    for(int i=ASYNC_INDEX_READ;i<NR_ASYNC_OPERATIONS;i++)
    510511    {
    511         while(TRUE) {
     512        while(TRUE)
     513        {
    512514            lpRequest = findAndRemoveRequest(i, hHandle);
    513515
    514516            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
    516521                 if(i != ASYNC_INDEX_BUSY) {//thread that handles the request will delete it
    517522                    delete lpRequest;
  • trunk/src/kernel32/overlappedio.h

    r7598 r7604  
    1 /* $Id: overlappedio.h,v 1.7 2001-12-09 21:55:17 sandervl Exp $ */
     1/* $Id: overlappedio.h,v 1.8 2001-12-10 12:55:13 sandervl Exp $ */
    22
    33/*
     
    3939    {
    4040        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);
    4841    };
    4942
     
    5952    DWORD               dwEventMask;
    6053    DWORD               dwUserData;
    61     HANDLE              hEventCancel;
     54    BOOL                fCancelled;
    6255    ASYNCIOREQUEST     *next;
    6356};
     
    124117     HANDLE       hThreadWrite;
    125118     HANDLE       hEventExit;
     119     HANDLE       hEventCancel;
    126120     HANDLE       hEventPoll;
    127121     HANDLE       hEventRead;
Note: See TracChangeset for help on using the changeset viewer.