Rescheduling a method from inside the method

Hi all!

Consider the following code:

void X::method1()
{
    std::cout << "Hi\n";
    this -> scheduleOnce( SEL_SCHEDULE( &X::method1 ), 0.5f );
}

I notice that the method is not called once it is done the first time. Is it possible to schedule a method from inside the same method?

I think you can use Scheduler::schedule() if you want to schedule more than one time.

Thanks for the answer.

Actually, after researching a bit more, I think that the reason is that in another part of my code I also scheduleOnce the same method at a similar time and this may give troubles.


The last scheduleOnce overwrites any previous scheduleOnce of the same method, right?

Not, it will not overwrite previous schedule.
Could you please

  • paste more sample codes
  • write expected output
  • write actual output

Thanks.

Sorry for the big delay… After applying the same pattern in another scenario, I noticed that it works well, so the problem was in another part of my code.

Thanks.