mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
clean up ConnectionRepository on exit
This commit is contained in:
parent
7ed5437e15
commit
72da0ee5f1
@ -52,6 +52,8 @@ class ConnectionRepository(
|
|||||||
DoCollectionManager.__init__(self)
|
DoCollectionManager.__init__(self)
|
||||||
self.setPythonRepository(self)
|
self.setPythonRepository(self)
|
||||||
|
|
||||||
|
base.finalExitCallbacks.append(self.shutdown)
|
||||||
|
|
||||||
self.config = config
|
self.config = config
|
||||||
|
|
||||||
if self.config.GetBool('verbose-repository'):
|
if self.config.GetBool('verbose-repository'):
|
||||||
@ -591,6 +593,7 @@ class ConnectionRepository(
|
|||||||
def readerPollUntilEmpty(self, task):
|
def readerPollUntilEmpty(self, task):
|
||||||
while self.readerPollOnce():
|
while self.readerPollOnce():
|
||||||
pass
|
pass
|
||||||
|
Thread.forceYield()
|
||||||
return Task.cont
|
return Task.cont
|
||||||
|
|
||||||
def readerPollOnce(self):
|
def readerPollOnce(self):
|
||||||
|
@ -665,6 +665,22 @@ disconnect() {
|
|||||||
_simulated_disconnect = false;
|
_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
|
// Function: CConnectionRepository::do_check_datagram
|
||||||
// Access: Private
|
// Access: Private
|
||||||
|
@ -144,6 +144,7 @@ PUBLISHED:
|
|||||||
bool flush();
|
bool flush();
|
||||||
|
|
||||||
void disconnect();
|
void disconnect();
|
||||||
|
void shutdown();
|
||||||
|
|
||||||
INLINE void set_simulated_disconnect(bool simulated_disconnect);
|
INLINE void set_simulated_disconnect(bool simulated_disconnect);
|
||||||
INLINE bool get_simulated_disconnect() const;
|
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."""
|
This function is designed to be safe to call multiple times."""
|
||||||
|
|
||||||
|
for cb in self.finalExitCallbacks:
|
||||||
|
cb()
|
||||||
|
|
||||||
# [gjeon] restore sticky key settings
|
# [gjeon] restore sticky key settings
|
||||||
if self.config.GetBool('disable-sticky-keys', 0):
|
if self.config.GetBool('disable-sticky-keys', 0):
|
||||||
allowAccessibilityShortcutKeys(True)
|
allowAccessibilityShortcutKeys(True)
|
||||||
@ -458,9 +461,6 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
vfs = VirtualFileSystem.getGlobalPtr()
|
vfs = VirtualFileSystem.getGlobalPtr()
|
||||||
vfs.unmountAll()
|
vfs.unmountAll()
|
||||||
|
|
||||||
for cb in self.finalExitCallbacks:
|
|
||||||
cb()
|
|
||||||
|
|
||||||
|
|
||||||
def exitfunc(self):
|
def exitfunc(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user