Changeset 7596 for trunk/src


Ignore:
Timestamp:
Dec 9, 2001, 10:19:28 PM (24 years ago)
Author:
sandervl
Message:

Overlapped IO fix (poll)

Location:
trunk/src/kernel32
Files:
2 edited

Legend:

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

    r7583 r7596  
    1 /* $Id: hmcomm.cpp,v 1.31 2001-12-08 15:44:30 sandervl Exp $ */
     1/* $Id: hmcomm.cpp,v 1.32 2001-12-09 21:19:28 sandervl Exp $ */
    22
    33/*
     
    634634        ::SetLastError(ERROR_INVALID_PARAMETER);
    635635        return FALSE;
     636    }
     637
     638    if(pHMHandleData->dwFlags & FILE_FLAG_OVERLAPPED)
     639    {
     640        return pDevData->iohandler->WaitForEvent(pHMHandleData->hWin32Handle, pDevData->dwEventMask, lpfdwEvtMask,
     641                                                 lpo, NULL, (DWORD)pDevData);
    636642    }
    637643
     
    666672        else break;
    667673
    668         if(pHMHandleData->dwFlags & FILE_FLAG_OVERLAPPED)
    669         {
    670             return pDevData->iohandler->WaitForEvent(pHMHandleData->hWin32Handle, pDevData->dwEventMask, lpfdwEvtMask,
    671                                                      lpo, NULL, (DWORD)pDevData);
    672         }
    673674        DosSleep(TIMEOUT_COMM);
    674675    }
     
    725726  PHMDEVCOMDATA pDevData = (PHMDEVCOMDATA)pHMHandleData->lpHandlerData;
    726727
    727     dprintf(("KERNEL32-WARNING: HMDeviceCommClass::GetOverlappedResult(%08xh,%08xh,%08xh,%08xh) partly implemented",
     728    dprintf(("KERNEL32-WARNING: HMDeviceCommClass::GetOverlappedResult(%08xh,%08xh,%08xh,%08xh)",
    728729             pHMHandleData->hHMHandle, lpOverlapped, lpcbTransfer, fWait));
    729730
  • trunk/src/kernel32/overlappedio.cpp

    r7567 r7596  
    1 /* $Id: overlappedio.cpp,v 1.7 2001-12-07 14:13:38 sandervl Exp $ */
     1/* $Id: overlappedio.cpp,v 1.8 2001-12-09 21:19:28 sandervl Exp $ */
    22
    33/*
     
    428428{
    429429    LPASYNCIOREQUEST lpRequest, current;
     430    DWORD            dwLastError, dwResult;
    430431
    431432    if(!lpOverlapped || lpOverlapped->hEvent == 0) {
     433        ::SetLastError(ERROR_INVALID_PARAMETER);
     434        return FALSE;
     435    }
     436    if(!lpPollHandler) {
     437        DebugInt3();
    432438        ::SetLastError(ERROR_INVALID_PARAMETER);
    433439        return FALSE;
     
    451457    lpRequest->next                = NULL;
    452458
     459    lpOverlapped->Internal     = ERROR_IO_PENDING;
     460    lpOverlapped->InternalHigh = 0;
     461    lpOverlapped->Offset       = 0;
     462    lpOverlapped->OffsetHigh   = 0;
     463    //reset overlapped semaphore to non-signalled
     464    ::ResetEvent(lpOverlapped->hEvent);
     465
     466    //first check if the event has already occured; if so, return result
     467    //immediately
     468    dwLastError = lpPollHandler(lpRequest, &dwResult, &dwTimeOut);
     469    if(dwLastError != ERROR_IO_PENDING)
     470    {
     471        dprintf(("OverlappedIOHandler::WaitForEvent %x: result %x, last error %d", lpOverlapped, dwResult, dwLastError));
     472        lpOverlapped->Internal     = dwLastError;
     473        lpOverlapped->InternalHigh = dwResult;
     474        if(lpfdwEvtMask) {
     475            *lpfdwEvtMask = dwResult;
     476        }
     477        //wake up user thread
     478        ::SetEvent(lpOverlapped->hEvent);
     479
     480        delete lpRequest;
     481        ::SetLastError(dwLastError);
     482        return (dwLastError == ERROR_SUCCESS);
     483    }
     484
    453485    ::EnterCriticalSection(&critsect);
    454486    if(pending[ASYNC_INDEX_POLL]) {
     
    462494    ::LeaveCriticalSection(&critsect);
    463495
    464     lpOverlapped->Internal     = ERROR_IO_PENDING;
    465     lpOverlapped->InternalHigh = 0;
    466     lpOverlapped->Offset       = 0;
    467     lpOverlapped->OffsetHigh   = 0;
    468     //reset overlapped semaphore to non-signalled
    469     ::ResetEvent(lpOverlapped->hEvent);
    470 
    471496    //wake up async thread
    472497    ::SetEvent(hEventPoll);
     
    514539    ::SetLastError(lpOverlapped->Internal);
    515540
     541    dprintf(("GetOverlappedResult %x -> result %d last error %d", hHandle, lpOverlapped->InternalHigh, lpOverlapped->Internal));
    516542    return (ret == WAIT_OBJECT_0);
    517543}
Note: See TracChangeset for help on using the changeset viewer.