detect the ShowBase window close

i’m using a network module ( [UDP Delay) ) that uses a differet thread (i think!! i’m not good in concurrency) on ubuntu and i’m launching my panda3d application in this way:
when i close the windows of panda the shell does not stops because the network thread is still running.
i explicitly have to stop it.
there is some callback to ShowBase window close?

If you have subclassed ShowBase, then overload userExit() (make sure to upcall to ShowBase.userExit when you’re done).

If you haven’t subclassed ShowBase, you can assign base.exitFunc to point to your own function, e.g. base.exitFunc = self.myExitFunc. In this case you do not have to upcall.