Mouse polling

Scott Raney raney at
Mon Mar 4 13:17:01 EST 2002

On Sun, 3 Mar 2002 =?ISO-8859-1?Q?Bj=F6rnke_von_Gierke?= <bvg at> wrote:

> >> I just don't understand how this can lead to any problem at all? A
> >> different mater is the following example:
> >>
> >> script:
> >> repeat while the mouse is down
> >> set the loc of field "grabMe" to the mouseLoc
> >> end repeat
> >
> > This is really the core of the problem: this loop uses 100% of the CPU
> > time, regardless of the speed of the processor, bringing the system to
> > its knees, causing poor feedback for your app, and making your system
> > unresponsive to any other processes running on it.  You see, on a fast
> > system, 99.99% of the time through that loop you're setting the loc to
> > exactly the same coordinate!
> Ok I got it kinda, thanks to the 99.99 % ... but why exactly does it 
> bring the multiuser enviroment to its knees? I mean, the following 
> doesn't do any harm (as far as I know):
> set the myOwnProperty of Stack "StackWithCustomProperties" to 0.001
> repeat until the myOwnProperty of Stack "StackWithCustomProperties" > 
> 0.234
>    add 0.001 to the myOwnProperty  of Stack "StackWithCustomProperties"
> end repeat
> so why is "the mouse" a system hog, but any other property isn't?

Because the second example is (presumably) actually doing some useful
work whereas the former isn't.  It will also complete at some point,
whereas something like running the "xy" handler in HyperCard (which
polls the mouseLoc in a repeat loop until a mouseClick), followed by
the user answering the phone or going to lunch or leaving for the day
won't.  The syadmin then gets a report that one of the systems on the
network is not responding to network requests, discovers a runaway
process on that system, removes the offending program from the system
and bans it, and possibly all MC/RR applications, from company
computers.  Then he or she posts an off-hand remark on some developer
newsgroup about this terrible program and we *all* find ourselves in
deep kim chee.  Anybody who thinks there's a big distance between
using "the programming tool for the rest of us" and "the programming
tool that's only suitable for people who don't know what they're doing
to develop toy applications " hasn't learned the one of the key
lessons from the demise of HyperCard.

> still confused
> Björnke von Gierke

Scott Raney  raney at
MetaCard: You know, there's an easier way to do that...

More information about the use-livecode mailing list