Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!spool.mu.edu!cs.umn.edu!thelake!steve From: steve@thelake.mn.org (Steve Yelvington) Newsgroups: comp.sys.atari.st Subject: Re: GFA Basic timeout INP possible ? Message-ID: Date: 28 Jun 91 21:45:28 GMT References: <035236.9564@timbuk.cray.com> <21046@sdcc6.ucsd.edu> Organization: A private system in Minnesota's St. Croix Valley Lines: 30 X-UUCP-route: {rutgers,plains,decwrl}!umn-cs!thelake!steve [In article <21046@sdcc6.ucsd.edu>, wernst@sdcc13.ucsd.edu (WarDoggie woof woof..) writes ... ] > In article <035236.9564@timbuk.cray.com> mpj@sequoia.cray.com (M. P. Johnson) writes: >> >>Does anyone know if GFA Basic will allow [timeouts]? Apparently not; >>so far my programs hang on the INP if there is no more input. > > Check if there's anything waiting for you with INP?(#channel). > It'll return a TRUE if there is, a FALSE if there ain't. If you > want to time input, say with a FOR loop: > > FUNCTION get_input > FOR i%=1 TO 1000 > IF INP?(#1)=TRUE THEN > RETURN INP(#1) > ENDIF > NEXT i% > RETURN 0 ! Or whatever > ENDFUNC Using a counted loop as a timer is not a good idea in this day of multiple processors and speeds. Better to check the value of a system clock, so that the program will not behave in a strange fashion when executed on a Mega STE or TT030. ---- Steve Yelvington If mail fails, try steve%thelake@cs.umn.edu ... the Minnesota domain MX site jhereg.osa.com apparently has been having difficulties.