Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!oliveb!isc-br!jimc From: jimc@isc-br.ISC-BR.COM (Jim Cathey) Newsgroups: comp.sys.mac.programmer Subject: Re: Animation Message-ID: <3021@isc-br.ISC-BR.COM> Date: 14 Feb 91 00:55:08 GMT References: <9102030634.AA09598@enuxha.eas.asu.edu> <1991Feb7.093610.12594@ecmwf.co.uk> <1991Feb7.233344.7781@umiami.ir.miami.edu> Organization: ISC-Bunker Ramo, An Olivetti Company Lines: 38 In article <1991Feb7.233344.7781@umiami.ir.miami.edu> dweisman@umiami.ir.miami.edu (Ordinary Man) writes: >[From IM page mumble]: >"...don't rely on the tick count being incremented to a certain value, such >as testing whether it has become equal to its old value plus 1; check for >'greater than or equal to' (since an interrupt task may keep control for >more than one tick)." > >So instead say: > > tmp:=TickCount; > repeat until TickCount>=(tmp+1); > > CopyBits..... Of course even this isn't completely correct (foolproof). Eventually (2 years or so isn't it?) TickCount will overflow and you could get into a place where you would wait forever. (Yes I know the chances are small, but it's nice to learn the right way too isn't it?) The most correct way to hang until TickCount changes is: > tmp:=TickCount; > repeat until TickCount <> tmp; > > CopyBits..... This also should generate less code and will always work. After all, you don't give a hoot about _which_ value it's moving to, you just want to wait until it changes. +----------------+ ! II CCCCCC ! Jim Cathey ! II SSSSCC ! ISC-Bunker Ramo ! II CC ! TAF-C8; Spokane, WA 99220 ! IISSSS CC ! UUCP: uunet!isc-br!jimc (jimc@isc-br.isc-br.com) ! II CCCCCC ! (509) 927-5757 +----------------+ "With excitement like this, who is needing enemas?"