move the NodeList to the thread used for a ThreadedAssignment

This commit is contained in:
Stephen Birarda 2014-01-14 11:26:26 -08:00
parent e888366fd8
commit fa01383f3f
4 changed files with 10 additions and 5 deletions

View file

@ -148,6 +148,9 @@ void AssignmentClient::readPendingDatagrams() {
_currentAssignment->moveToThread(workerThread);
// move the NodeList to the thread used for the _current assignment
nodeList->moveToThread(workerThread);
// Starts an event loop, and emits workerThread->started()
workerThread->start();
} else {
@ -172,6 +175,9 @@ void AssignmentClient::assignmentCompleted() {
NodeList* nodeList = NodeList::getInstance();
// move the NodeList back to our thread
nodeList->moveToThread(thread());
// reset our NodeList by switching back to unassigned and clearing the list
nodeList->setOwnerType(NODE_TYPE_UNASSIGNED);
nodeList->reset();

View file

@ -39,7 +39,7 @@ Node::Node(const QUuid& uuid, char type, const HifiSockAddr& publicSocket, const
}
Node::~Node() {
Node::~Node() {
if (_linkedData) {
_linkedData->deleteOrDeleteLater();
}

View file

@ -789,7 +789,6 @@ void NodeList::removeSilentNodes() {
NodeHash::iterator nodeItem = _nodeHash.begin();
while (nodeItem != _nodeHash.end()) {
SharedNodePointer node = nodeItem.value();
QMutexLocker(&node->getMutex());

View file

@ -41,9 +41,9 @@ void ThreadedAssignment::commonInit(const char* targetName, NODE_TYPE nodeType)
connect(pingNodesTimer, SIGNAL(timeout()), nodeList, SLOT(pingInactiveNodes()));
pingNodesTimer->start(PING_INACTIVE_NODE_INTERVAL_USECS / 1000);
QTimer* silentNodeTimer = new QTimer(this);
connect(silentNodeTimer, SIGNAL(timeout()), nodeList, SLOT(removeSilentNodes()));
silentNodeTimer->start(NODE_SILENCE_THRESHOLD_USECS / 1000);
QTimer* silentNodeRemovalTimer = new QTimer(this);
connect(silentNodeRemovalTimer, SIGNAL(timeout()), nodeList, SLOT(removeSilentNodes()));
silentNodeRemovalTimer->start(NODE_SILENCE_THRESHOLD_USECS / 1000);
}
void ThreadedAssignment::checkInWithDomainServerOrExit() {