WaitForSingleObject

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Ertan EFE (ertanefe_at_hotmail.com)
Date: 04/29/04


Date: Thu, 29 Apr 2004 13:51:41 +0300

hi,

I use WaitForSingleOject API to wait for an event. Event is coming from
WaitCommEvent in Listener thread, I set the com mask SetCommMask API
EV_RXCHAR parameter.

ý use a loopback atapter that connectod to com1. I use WriteFile API, then
this action stops the waitin state of listener thread that waiting for
incoming data. then I Use the ReadFile APý functiýon to retrieve written
bytes. But when I read all contents from the file with ReadFile API,
WaitForSingleObject is not wait second times in listener loop.

why WaitForSingleObject can't wait and signaled while incoming buffer free..

but when I send only one char at a time then all logic completely executing
without error. RxChar event comes only one at a time. when I send the 2, 3,
4, vs. lenghted byte array EV_RXCHAR coming two times. at the first time
ReadFile Read All Contents of incoming buffer, second times read 0 bytes
from the file. since if EV_RXCHARis coming why ReadFile Reads 0 bytes. real
eror is EV_RXCHAR event is comes Two times.

how can I restrict this? or how can ý solve this problem



Relevant Pages

  • Re: how can i create an simple event under c#
    ... method signatures for WaitForSingleObject and CreateEvent have been posted. ... As I recall, SetEvent isn't actually an API call, but maps to ModifyEvent ... CreateEvent is declared in core.cs. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Shouldnt ReadFile block when timeouts are specified ???
    ... ORC wrote: ... The readfile is implemented ... I have set the COMMTIMEOUTS (also part of the API) to ... in either one of the PocketPC groups, or the Compact Framework group. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Termination Handler
    ... If you are launching your process with the API CreateProcess, ... you can use the following APIs to signal the caller process that ... WaitForSingleObject() ...
    (microsoft.public.win32.programmer.kernel)
  • CreatePipe() problem
    ... I am injecting a DLL into Acrobat reader process to trace the ReadFile ... API. ... named pipe which is collected at the host process. ...
    (microsoft.public.vc.language)
  • help closing handle of thread
    ... My main thread is creating a work thread (using CreateThread API). ... But I can't use WaitForSingleObject, since it will make my thread act ...
    (microsoft.public.vc.mfc)