TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: David Muir
from: Peter Fitzsimmons
date: 1995-08-22 15:42:00
subject: Communication/Thread problems

DM>     I think the above strategy would alleviate this 
 DM> problem. if there are 
 DM> chars, read them, otherwise release the time slice. If

It is better to use "Wait for something" read timeout processing;
 this way,your application is blocked in the DD -- who is the one who knows
the instant something is avaiable.

There is no need to call an ioctl to see if characters are waiting.

There is no need to call DosSleep

        1) Put port into "wait for something" mode.
        2) Set a long timeout (>5000ms).
        3) In an infinite loop,  call DosRead() with a large (>1000)
           buffer.  If it returns ByteRread == 0,  it means it timed out
           (a good time to test the carrier).
        4) If it returned BytesRead > 0,  your program got the bytes
           without hesitation (ie: DosRead() does not wait for your
           whole buffer to be filled if there is a pause in the incoming
           data) .


--- Maximus/2 3.00
* Origin: Sol 3 * Toronto * V.32 * (905)858-8488 (1:259/414)
SEEN-BY: 105/42 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809
@PATH: 259/414 400 99 250/99 3615/50 396/1 270/101 105/103 42 712/515
@PATH: 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.