Stop and eliminate Parallel intervals without error

To summarize them say that I have a game client / server I tested in the same PC and use Parallel to move to the player with the mouse only.

Try to eliminate the interval (Parallel) with the code I found here and put below but after a few consecutive clicking an error is generated in the interval:

    if self.playerMovement:
           self.playerMovement = None

After studying the classes and their methods to modify the code as follows:

    if self.playerMovement:
           maneger = self.playerMovement.getManager()
           self.playerMovement = None

With one client open takes time to make the error but with 3 or 4 gives fast:

Someone can help halt and eliminate Parallel intervals without generating an error? I have 2 weeks in this and I see no light.


I think this is the correct syntax for stopping intervals:


if you want to stop the interval without finishing it, try

ivalMgr.removeInterval( yourIntervalHere )

Actually, pause() is the correct way to stop an interval without finishing it. If that is generating an error, something is wrong. Can you tell me more about the specific problem this caused?

You should never call removeInterval() explicitly. That is intended to be an internal method, and calling it directly is almost certain to cause problems.


Greetings friends and thanks for your interest in my problem.

First of all using the excuse that this translator google because I understand some English but I am not good writing.

Then they leave a link where you can download all the code from my server massive and his client so that if by any side in the forum there that would help them and in turn the hearing over this that I correct any errors you may have.

Unfortunately for you the var are in Spanish because I am Venezuelan, I am sorry for that.

From everything that is in the folder Panda3D edin use only .py and some things on mapas and personajes the other else are evidence that mine are not necessary.

The server and the client is can run all client who want it by the time of how this code is generated and occasionally Warning a mistake but the most strange is that only the client and The server uses the same class jugador that is where the error is generated.

The error is generated in the class jugador in the detener function which is used mainly in the function mover. For you yourself tests mark the two lines that remove the interval and uncheck the two who pause.

I hope that when tested the game to see the same mistake and that I give you the correct solution thanks in advance.


After a dream revealing apparently found the problem

The client receives the information from the server in a cycle WHILE this in a THREAD, apparently when commanded to pause an interval generates an error on some occasions because the request is not synchronized with the interval.

If someone tried the code can check by placing the call to pause the interval within a function task.

Whether they have any opinion on the code I am all ears

Hmm, I’m not sure that the Interval system is designed to be thread-safe. You’d be best to ensure that you don’t make multiple calls into the Interval system from different threads. Maybe you should define just one thread to do all of your Interval calls?

Of course, if you are using multiple threads in conjunction with Panda, you will have other problems too, unless you have compiled your own version of Panda specifically enabling thread support.