Mail Archives: djgpp/1997/11/13/05:15:29
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.
> Yes, somebody else posted that his mouse becomes bumpy in some cases
> when he calls __dpmi_yield(). So calling it all the time is probably not
> really a Good Idea.
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.
> OTOH, what do you think about an environment/_CRT0_FLAG option (like
> LFN/_CRT0_FLAG_NO_LFN) that controls if kbhit() should call
> __dpmi_yield() internally or not?
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).
- Raw text -