I am using Display.callSerially(Runnable r) to synch a game canvas with the event stream. Can anyone tell me how callSerially is implemented on the NOKIA phones/emulators?
My problem is that I have more than one runnable canvas, one for each interactive screen in my game. Only one is ever running at any given time, but when the second is running, the run() method of the first is also mysteriously called every event cycle.
The code works fine on other emulators/phones. My hunch is that callSerially(r) on NOKIA adds r to a list of runnables that is maintained through the life of the MIDlet (instead of being purged every event cycle), so every runnable that was ever passed into callSerially() has its run() method called whenever callSerially is executed in the future.
The spec says "The run() method will be called exactly once for each call to callSerially()." which doesn't precisely rule out what I'm seeing here. The run() method for every runnable ever passed to callSerially in the lifetime of the MIDLet will be called exactly once for each subsequent call to callSerially().
Does anyone know if this is the way things are? I can see it might be useful, but there is no way to remove a runnable (I tried calling callSerially(null)).
I will try to develop a small example to demonstrate.