Mouse polling
Björnke von Gierke
bvg at mac.com
Sun Mar 3 17:47:01 EST 2002
On Sonntag, März 3, 2002, at 07:25 , Scott Raney wrote:
(snipedisnip)
>> 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?
still confused
Björnke von Gierke
More information about the use-livecode
mailing list