Ada: Text_Io.Get_Immediate() is blocking

Martin Haendler Extern.Haendler@kmweg.de
Tue Sep 7 14:31:00 GMT 2004


Hi,
I'm working with ADA and Windows2000/Cygwin.

A call to Text_Io.Get_Immediate() should return even if there is no 
input waiting. I have no problems with Linux, but trying to shift 
Software to Windows brings me into trouble: If there is no input 
waiting, the call is blocking.

Here is a simple example:
(Save it as "keyboardtest.adb" and call "gnatmake keyboardtest".)
===================================================
with Text_Io;
procedure Keyboardtest is
    Char : Character := ' ';
    Key_Pressed : Boolean := False;
begin
    Text_Io.Get_Immediate(Char, Key_Pressed);
    if Key_Pressed then
        Text_Io.Put_Line("[" & Char & "]");
    end if;
end Keyboardtest;
===================================================

With Linux (gcc version 3.2.3, GNAT Pro 5.02a) this program terminates 
immediately which is the correct behaviour. With Win2000/Cygwin it waits 
until a key is pressed, prints out the key and then terminates.

"gcc -v" says:
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/specs
Configured with: /GCC/gcc-3.3.1-3/configure --with-gcc --with-gnu-ld 
--with-gnu-as --prefix=/usr --exec-prefix=/u
sr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/sbin 
--mandir=/usr/share/man --infodir=/usr/share/info -
-enable-languages=c,ada,c++,f77,pascal,java,objc --enable-libgcj 
--enable-threads=posix --with-system-zlib --enab
le-nls --without-included-gettext --enable-interpreter 
--enable-sjlj-exceptions --disable-version-specific-runtim
e-libs --enable-shared --disable-win32-registry --enable-java-gc=boehm 
--disable-hash-synchronization --verbose -
-target=i686-pc-cygwin --host=i686-pc-cygwin --build=i686-pc-cygwin
Thread model: posix
gcc version 3.3.1 (cygming special)

"gnat" says:
GNAT 3.3.1 (cygming special) Copyright 1996-2002 Free Software 
Foundation, Inc.

Do you know any solution or workaround? Thank you!!!

Martin


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list