hessmann@r2d2.fmi.uni-passau.de (Georg Hessmann) (04/09/91)
Hi, Has someone written a WaitIO function, which waits on the IO *and* on CTRL-C ? Maybe a function, which abort the IO and results an error-code if a CTRL-C appeares. Thanks, Georg. -- hessmann@unipas.fmi.uni-passau.de hessmann@unipas.uucp
u8705377@cs.uow.edu.au (Paul Anthony Wilkinson) (04/09/91)
hessmann@r2d2.fmi.uni-passau.de (Georg Hessmann) writes: >Hi, >Has someone written a WaitIO function, which waits on the >IO *and* on CTRL-C ? >Maybe a function, which abort the IO and results an >error-code if a CTRL-C appeares. > Thanks, > Georg. Hi. The following code will achieve what you want: eg: SerialIO->IOSer.io_Command = CMD_READ; SerialIO->IOSer .... etc SendIO(SerialIO); /* Start IO but do not wait */ Wait( SIGBREAKF_CTRL_C | 1L << SerialMP->mp_SigBit); SerialMP is a pointer to the message port associated with your IOExtSer or whatever. This waits on the signal bit of the message port (which is set when the device "Replys" to your IO request) OR the CTRL-C Signal. Regards, Paul Wilkinson u8705377@wraith.cs.uow.edu.au #include <std_disclaimer.h>
jap@convex.cl.msu.edu (Joe Porkka) (04/10/91)
hessmann@r2d2.fmi.uni-passau.de (Georg Hessmann) writes: >Hi, >Has someone written a WaitIO function, which waits on the >IO *and* on CTRL-C ? Nope it aint possible. However, you can use Wait(), the much more general function. #include <libraries/dos.h> /* Perhaps dosextens too */ mask = SIGBREAKF_CTRL_C | (1 << mymsgport->mp_SigBit); bits = Wait(mask); if(bits & SIGBREAKF_CTRL_C) { handle ctrl c } Where mymsgport is the port that you are expecting your IO message to come back on. Generally, the only time I use WaitIO is for: AbortIO(foo); WaitIO(foo);
jesup@cbmvax.commodore.com (Randell Jesup) (04/13/91)
In article <1991Apr9.133921.11938@cs.uow.edu.au> u8705377@cs.uow.edu.au (Paul Anthony Wilkinson) writes: >>Has someone written a WaitIO function, which waits on the >>IO *and* on CTRL-C ? > SendIO(SerialIO); /* Start IO but do not wait */ > Wait( SIGBREAKF_CTRL_C | 1L << SerialMP->mp_SigBit); > > SerialMP is a pointer to the message port associated with your > IOExtSer or whatever. > >This waits on the signal bit of the message port (which is set when >the device "Replys" to your IO request) OR the CTRL-C Signal. One thing to be careful of: when using requests and ports in this manner, it's possible for the signal bit to alreayd be set when you do the SendIO. You should NEVER assume the request has come back until you either WaitIO(), or GetMsg() it from the port (you could use CheckIO to know whether to call WaitIO/GetMsg, especially useful if the port is ued for multiple requests, etc). -- Randell Jesup, Keeper of AmigaDos, Commodore Engineering. {uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.commodore.com BIX: rjesup Disclaimer: Nothing I say is anything other than my personal opinion. Thus spake the Master Ninjei: "To program a million-line operating system is easy, to change a man's temperament is more difficult." (From "The Zen of Programming") ;-)