Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COM-port event

Status
Not open for further replies.

Totte

Programmer
Jun 6, 2001
317
SE
I have no problem with opening the COM-port (serial device) and reading and writing but i have seen somewhere that i can make make it do a sort of "SetEvent" when there are incoming data on the serial port. I.e. the OS doing the "SetEvent".
 
Did sort of fix it myself: i discovered that by setting the timeouts at certain values when opening the port can hold the thread untill something is incoming on the serial port.
BUT, this leaves me with the problem: if i'm having a WaitForSingleOblect or similar with infinite timeout pending and i'm terminating the whole program...then wat happens when something comes in on the serial port???
Will the pending event dissapear??? If so, it's no sweat.
 
You need to create a new thread. That way the thread will do the waiting while the program can do something else.
James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that I am now qualified
to do anything with nothing.
 
I have a separate thread which checks for incoming bytes and dos the decoding and by investigating more i discovered that if i set the timeouts at certain values it halts, waiting for the first incoming and the halt is done in the OS, thus freeing resurses. This is the very effect i wanted, i do not know what "CPU-power" my application will be running om but it will be mostly on LapTops and they might be old!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top