Path: utzoo!attcan!uunet!mcvax!enea!kth!draken!tut!ra!tucos!abo.fi!rosenbergr From: rosenbergr@abo.fi (Robin Rosenberg) Newsgroups: comp.sys.amiga.tech Subject: Re: Non-blocking keyboard reads Message-ID: <2802@abo.fi> Date: 19 Jan 89 10:15:40 GMT References: <1004@husc6.harvard.edu> Organization: Abo Academy, Finland Lines: 23 In article <1004@husc6.harvard.edu>, wen@husc4.HARVARD.EDU (A. Wen) writes: > I've been mulling over ways to do non-blocking keyboard reads without > polling the keyboard; is there any way that I can be signalled when the > console device has input available short of creating a new task to block > for input and then signal its parent process? > > That is, if I am waiting for the timer to wake me up, but I need to be notified > of any keystrokes that may occur in the meantime, is there anything simple > (short of busy-waiting) that I can do? > You could do it several ways. If you are using windows with IDCMP you might wait for VANILLA or RAWKEY messages (whichever you put into the IDMCP Flags). What I think you missed is the fact that you can do *asynchronous* device io. Use the console device. This will decode the keyboard correctly and give you funtion keys as well. You SendIO READ requests to the console device. The device will signal you when it has something to deliver. When you get the signal you get the reply with WaitIO(). There is an example in RKM Libraries and devices. If I'm not mistaken it also works. ------ Robin Rosenberg, Abo Akademy, FINLAND email: