BMessageRunner granularity is too high
|Reported by:||joeyadams||Owned by:||nobody|
While porting a game of mine to Haiku, I reached a point where I needed a periodic timer to update the game state at roughly 60 frames per second. The closest things I could find to this in the API were Pulse() and BMessageRunner. Though these do send messages periodically, they have a granularity limit of around 10 intervals per second. I then looked in the Media kit and BTimeSource, and was confused quite quickly. Lastly, I asked on the mailing list how to do what I want, and the solution I arrived at was to implement it manually using threads, semaphores, and callbacks.
Other GUI toolkits I've seen have Timers which can be set to periodically send messages at arbitrary rates. I believe the Haiku API should also have this feature, most likely in the form of a BTimer.
To this end, I have attached a working draft and example for a BTimer system. It provides a convenient interface for scheduling messages and callbacks to run at periodic intervals. It would be nice to see it included in the Haiku API, most likely in the Support kit. However, it would need to be reviewed by more experienced eyes.
Change History (19)
comment:1 by , 13 years ago
|Component:||Kits → Kits/Application Kit|
|Milestone:||R1 → Unscheduled|
comment:9 by , 2 years ago
|Summary:||There should be a BTimer → BMessageRunner granularity is too high|