Re: ReadFile blocking even when it shouldn't



aaa wrote:

I have an application where the main thread holds three subthreads. All three threads have message handling routines (MsgWaitForMultipleObjects and WSAWaitForMultipleEvents). However, going through the code with the debugger one of the threads seem to get stuck at a call to ReadFile which should be non-blocking (see below). Why does this method block?

ZeroMemory(&l_this->m_overlapped, sizeof(l_this->m_overlapped));
l_handleArray[1] = CreateEvent(NULL, TRUE, FALSE, "COMPORTEVENT");
l_this->m_overlapped.hEvent = l_handleArray[1];
ReadFile(l_this->m_hCOMport, &l_recvStr, sizeof(char) * (l_recvStrLen - 1), NULL, &l_this->m_overlapped); //Why does it block here?



Too much detail about irrelevant things, not enough detail about relevant things. Does your CreateFile call open the port for overlapped I/O? Which Windows version are you using?


--
Scott McPhillips [VC++ MVP]

.



Relevant Pages

  • Dolphin 5.1.4 / Windows Vista / Ctrl-Break acts stuck...
    ... When I am using Dolphin 5.1.4 on Windows Vista and I have to press Ctrl-Break while a debugger is open the system acts like Ctrl-Break is stuck and keeps breaking when I try to open a new browser or debugger. ...
    (comp.lang.smalltalk.dolphin)
  • Re: POP3 Locking up computer
    ... (other threads or GUI controls). ... if they stop responding, they are stuck somewhere. ... Your first step is to use the debugger and find out where your ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Finding a point where a program is stuck in a loop
    ... source code so I'm doing it with the disassembly. ... is there a way to nail down where its getting stuck? ... This is a windows program, and I'm using ollydbg as the debugger. ...
    (comp.lang.asm.x86)
  • Re: POP3 Locking up computer
    ... while they are being downloaded nothing else works (other threads or GUI controls). ... I tried async reads, that didn't work. ... Applications don't just stop for no reason; if they stop responding, they are stuck somewhere. ... Your first step is to use the debugger and find out where your application is stuck. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: POP3 Locking up computer
    ... (other threads or GUI controls). ... I tried async reads, that didn't work. ... if they stop responding, they are stuck somewhere. ... Your first step is to use the debugger and find out where your ...
    (microsoft.public.dotnet.languages.csharp)