e-Picture

Be Developers:
Put your banner here!

 cubeprefsicon graphic [Bar]


Developing for BeOS
BeOS Internals

 

How fast should I poll the mouse for position changes? Should I just sit in a tight GetMouse(...) loop?

Top Up << >>
Developing for BeOS:
BeOS Internals
FAQ Number:
FAQ-0171
Last Modified:
3/31/98
Keywords:
BeOS, Developing, Internals, interrupt, mouse, position, GetMouse
If you poll the mouse position, do use a sleep time somewhere in the loop, otherwise you will waste a full CPU getting the mouse position 10,000 times per second!

For example:

while(xyz)
  {GetMouse(&a_point etc...);
snooze(X microseconds);}

As a rule of thumb, polling about 50 times a second (i.e., every 20,000 +/- microseconds) seems about right.


<< Does the BeOS allow for a preemptable kernel and nested interrupts?  Can I get source code for the mouse driver?  >>


Copyright © 1999 by Be, Inc. All rights reserved. Legal information (includes icon usage info).
Comments, questions, or confessions about our site? Please write the Webmaster.