mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
clean up ConnectionRepository on exit
This commit is contained in:
parent
7ed5437e15
commit
72da0ee5f1
@ -51,7 +51,9 @@ class ConnectionRepository(
|
||||
DoInterestManager.__init__(self)
|
||||
DoCollectionManager.__init__(self)
|
||||
self.setPythonRepository(self)
|
||||
|
||||
|
||||
base.finalExitCallbacks.append(self.shutdown)
|
||||
|
||||
self.config = config
|
||||
|
||||
if self.config.GetBool('verbose-repository'):
|
||||
@ -591,6 +593,7 @@ class ConnectionRepository(
|
||||
def readerPollUntilEmpty(self, task):
|
||||
while self.readerPollOnce():
|
||||
pass
|
||||
Thread.forceYield()
|
||||
return Task.cont
|
||||
|
||||
def readerPollOnce(self):
|
||||
|
@ -665,6 +665,22 @@ disconnect() {
|
||||
_simulated_disconnect = false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CConnectionRepository::shutdown
|
||||
// Access: Published
|
||||
// Description: May be called at application shutdown to ensure all
|
||||
// threads are cleaned up.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void CConnectionRepository::
|
||||
shutdown() {
|
||||
disconnect();
|
||||
|
||||
#ifdef HAVE_NET
|
||||
_cw.shutdown();
|
||||
_qcr.shutdown();
|
||||
#endif // HAVE_NET
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CConnectionRepository::do_check_datagram
|
||||
// Access: Private
|
||||
|
@ -144,6 +144,7 @@ PUBLISHED:
|
||||
bool flush();
|
||||
|
||||
void disconnect();
|
||||
void shutdown();
|
||||
|
||||
INLINE void set_simulated_disconnect(bool simulated_disconnect);
|
||||
INLINE bool get_simulated_disconnect() const;
|
||||
|
@ -429,6 +429,9 @@ class ShowBase(DirectObject.DirectObject):
|
||||
|
||||
This function is designed to be safe to call multiple times."""
|
||||
|
||||
for cb in self.finalExitCallbacks:
|
||||
cb()
|
||||
|
||||
# [gjeon] restore sticky key settings
|
||||
if self.config.GetBool('disable-sticky-keys', 0):
|
||||
allowAccessibilityShortcutKeys(True)
|
||||
@ -457,9 +460,6 @@ class ShowBase(DirectObject.DirectObject):
|
||||
|
||||
vfs = VirtualFileSystem.getGlobalPtr()
|
||||
vfs.unmountAll()
|
||||
|
||||
for cb in self.finalExitCallbacks:
|
||||
cb()
|
||||
|
||||
|
||||
def exitfunc(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user