TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Johannes Stratmann
from: Peter Fitzsimmons
date: 1997-03-15 02:02:24
subject: DosRead blocking

PF> This may actually be counter productive;  by servicing the device
 PF> driver too often,  you will call DosRead() more often (then if your
 PF> thread was running at a lower priority).  The DosRead() calls will
 PF> transfer fewer bytes with each call (perhaps as low as 1 to 10
 PF> bytes).  Since the overhead of calling DosRead() 
 PF> is _huge_,  you want
 PF> to call it as few times as possible,  and get as 
 PF> many bytes back with
 PF> each call (this is why "Wait for something" read timeout processing
 PF> is so cool).

 JS> The Timeout=0 seems to be dangerous in OS/2, because
 JS> when the Application want's to terminate it can lock 
 JS> the serial Port (or a Socket, the same applies). So I 
 JS> prefer polling the character count in the buffer that 
 JS> I'am able to react on a terminate flag. Or is it 
 JS> possible to close the serial device (or Socket) with 
 JS> an external Program (I wasn't successful when it tried 
 JS> this) ?

I know little about sockets.

I do know about com.sys and named pipes.

I do not understand "The Timeout=0 seems to be dangerous... "; 
this means no timeout (ie: polling).  Although polling is not dangerous, it
is repugnant (I was looking for a strong word!).

I do not know if you can close the com handle to unblock another thread
blocked on a DosRead() -- but it might (you actually HAVE to do this with
named pipes, even though it is rude).

I do know that you can change the read mode from another thread.  So let's
say a thread needs to "pause" using the com port,  and it is in
"wait for something" or "normal" mode.  Another thread
could change the readmode to "no wait",  and the thread blocked
on DosRead() would return (with "bytes read" set to 0) right
away.


--- Maximus/2 3.00
* Origin: Sol 3 * Toronto * V.32 * (905)858-8488 (1:259/414)
SEEN-BY: 50/99 54/99 270/101 620/243 625/160 711/401 413 430 934 712/311 407
SEEN-BY: 712/505 506 517 623 624 704 713/317 800/1
@PATH: 259/414 99 2424/38 11 10 12/12 396/1 270/101 712/624 711/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™.