I can't find any reference on doing something that should be really basic: I'd like to have a method called "forever" on the main UI loop. I would be happy both with an way to call my method synced with the UI refresh rate, or by passing a custom time granularity, as I don't really need it to happen more often than every 50-100 ms. Both answers for C++ (Carbon) and Objective C are fine, even though I will eventually use it in a pure C++ application. If you could suggest also how to remove this timer, it would be great.
Please check the comments for a further explanation of the threading scenario where I want to use this.
something like
class MySyncedClass {
void start() {
// start calling "execute" member function on main loop every N ms
}
void stop() {
// stop calling "execute"
}
void execute() {
// do something
}
};