www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/13/12:37:12

From: michael DOT mauch AT gmx DOT de (Michael Mauch)
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Cc: djgpp AT delorie DOT com
Subject: Re: RHIDE -- author(s) please read this
Date: Thu, 13 Nov 1997 18:34:29 +0100
Message-Id: <346e3480.11667399@unidui.uni-duisburg.de>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 971113121457 DOT 23305K-100000 AT is>
In-Reply-To: <Pine.SUN.3.91.971113121457.23305K-100000@is>
Mime-Version: 1.0

On Thu, 13 Nov 1997 12:15:17 +0200 (IST), Eli Zaretskii wrote:

> On Wed, 12 Nov 1997, Michael Mauch wrote:
> 
> > > IMHO, a better way is to use the `select' library function.  It is
> > > portable to Linux (and Unix in general) and calls `__dpmi_yield'
> > > internally while it waits.  It also has a time-out option.  Check it
> > > out in the library reference.
> > 
> > Yes, thank you for pointing that out. The only draw-back I see is that
> > it doesn't work if stdin is redirected.
> 
> Huh?  It does work for me.  Can you give an example where it doesn't?
> I used the test program created when you compile `select.c' in the
> libc sources with -DTEST.

Hmm, I checked that and it only kind of works (at least here, on Win95):
if stdin is not redirected, it waits until you press key and then prints

0:  ready for input
0:  ready for output
1:  ready for input
1:  ready for output

and the rest of it.

But if stdin is redirected, it immediately prints:

0:  ready for input
0:  ready for output

then it waits for the keystroke and prints the remainder.

Strange enough that I have to check if stdout is ready for input, but it
becomes worse if you redirect stdout as well:

in that case, stdout never becomes ready for input and select() waits
for 15 seconds before printing

1: NOT ready for input
1:  ready for output

Does the select.exe work for you when you redirect both stdin and
stdout?
 
> No, I think calling `__dpmi_yield' *is* a good idea, since it is
> either ignored (when the environment doesn't support it) or makes
> the program multitasking-friendly in those environments which do.  The
> bumpy mouse is probably caused by something else, not by
> `__dpmi_yield' itself.

Ok, then please, Robert, could you implement in the next release of
RHIDE?

> No, I think `kbhit' should work as advertised: only call the keyboard
> BIOS function.  It's the responsibility of the programmer to yield the
> time-slice if that's what they want.  Doing so is so easy that I don;t
> think it requires a bit in the crt0 flags (which is non-portable
> anyway).

Agreed.

Regards...
		Michael

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019