Home Help Center

_timer->schedule can not repeat call? Maybe it's document error?

sgsoftsgsoft Member Samon SunOrganization: FreelanceProject: Remote RFID Reader
In Ice 3.3 document:
You can call schedule or scheduleRepeated more than once on the
same Timer instance, passing the same TimerTask instance or a different one.

If you do, the tasks are executed according to the specified interval. However, all
tasks are executed by the same single thread so, for a single Timer instance, the
execution of all your tasks is serialized. The wait interval applies on a per-task
basis so, if you schedule task A at an interval of five seconds, and task B at an
interval of ten seconds, successive runs of task A start no sooner than five seconds
after the previous task A has finished, and successive runs of task B start no
sooner than ten seconds after the previous task B has finished. If, at the time a task
is scheduled to run, another task is still running, the new task’s execution is
delayed until the previous task has finished (regardless of whether it is the same or
a different task).

bug below code:
for(int i=0;i<100;i++)

will raise exception:
Timer.cpp:59: IceUtil::IllegalArgumentException: task is already schedulded

why? It's document error?


  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff

    Yes, it's a bug in the manual, you can't add multiple times the same task to a timer. Thanks for the report we'll fix this in the next release of the manual!

Sign In or Register to comment.