mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
more aggressively close threads (proper checkin this time)
This commit is contained in:
parent
233503776c
commit
f0d3e65d98
@ -96,15 +96,7 @@ ConnectionWriter::
|
||||
_manager->remove_writer(this);
|
||||
}
|
||||
|
||||
// First, shutdown the queue. This will tell our threads they're
|
||||
// done.
|
||||
_queue.shutdown();
|
||||
|
||||
// Now wait for all threads to terminate.
|
||||
Threads::iterator ti;
|
||||
for (ti = _threads.begin(); ti != _threads.end(); ++ti) {
|
||||
(*ti)->join();
|
||||
}
|
||||
shutdown();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -341,6 +333,7 @@ get_tcp_header_size() const {
|
||||
void ConnectionWriter::
|
||||
clear_manager() {
|
||||
_manager = (ConnectionManager *)NULL;
|
||||
shutdown();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -362,3 +355,22 @@ thread_run(int thread_index) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ConnectionWriter::shutdown
|
||||
// Access: Private
|
||||
// Description: Stops all the threads and cleans them up.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void ConnectionWriter::
|
||||
shutdown() {
|
||||
// First, shutdown the queue. This will tell our threads they're
|
||||
// done.
|
||||
_queue.shutdown();
|
||||
|
||||
// Now wait for all threads to terminate.
|
||||
Threads::iterator ti;
|
||||
for (ti = _threads.begin(); ti != _threads.end(); ++ti) {
|
||||
(*ti)->join();
|
||||
}
|
||||
_threads.clear();
|
||||
}
|
||||
|
@ -71,6 +71,7 @@ protected:
|
||||
private:
|
||||
void thread_run(int thread_index);
|
||||
bool send_datagram(const NetDatagram &datagram);
|
||||
void shutdown();
|
||||
|
||||
protected:
|
||||
ConnectionManager *_manager;
|
||||
|
Loading…
x
Reference in New Issue
Block a user