Fix two race conditions in meshrepo.
This commit is contained in:
@@ -569,6 +569,8 @@ LLMeshRepoThread::LLMeshRepoThread()
|
|||||||
mMutex = new LLMutex();
|
mMutex = new LLMutex();
|
||||||
mHeaderMutex = new LLMutex();
|
mHeaderMutex = new LLMutex();
|
||||||
mSignal = new LLCondition();
|
mSignal = new LLCondition();
|
||||||
|
mSkinInfoQMutex = new LLMutex();
|
||||||
|
mDecompositionQMutex = new LLMutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
LLMeshRepoThread::~LLMeshRepoThread()
|
LLMeshRepoThread::~LLMeshRepoThread()
|
||||||
@@ -579,6 +581,10 @@ LLMeshRepoThread::~LLMeshRepoThread()
|
|||||||
mHeaderMutex = NULL;
|
mHeaderMutex = NULL;
|
||||||
delete mSignal;
|
delete mSignal;
|
||||||
mSignal = NULL;
|
mSignal = NULL;
|
||||||
|
delete mSkinInfoQMutex;
|
||||||
|
mSkinInfoQMutex = NULL;
|
||||||
|
delete mDecompositionQMutex;
|
||||||
|
mDecompositionQMutex = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LLMeshRepoThread::HeaderRequest::fetch(U32& count)
|
bool LLMeshRepoThread::HeaderRequest::fetch(U32& count)
|
||||||
@@ -1167,7 +1173,9 @@ bool LLMeshRepoThread::skinInfoReceived(const LLUUID& mesh_id, U8* data, S32 dat
|
|||||||
info.mMeshID = mesh_id;
|
info.mMeshID = mesh_id;
|
||||||
|
|
||||||
//LL_INFOS() <<"info pelvis offset"<<info.mPelvisOffset<<LL_ENDL;
|
//LL_INFOS() <<"info pelvis offset"<<info.mPelvisOffset<<LL_ENDL;
|
||||||
|
mSkinInfoQMutex->lock();
|
||||||
mSkinInfoQ.push(info);
|
mSkinInfoQ.push(info);
|
||||||
|
mSkinInfoQMutex->unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -1193,7 +1201,9 @@ bool LLMeshRepoThread::decompositionReceived(const LLUUID& mesh_id, U8* data, S3
|
|||||||
{
|
{
|
||||||
LLModel::Decomposition* d = new LLModel::Decomposition(decomp);
|
LLModel::Decomposition* d = new LLModel::Decomposition(decomp);
|
||||||
d->mMeshID = mesh_id;
|
d->mMeshID = mesh_id;
|
||||||
|
mDecompositionQMutex->lock();
|
||||||
mDecompositionQ.push(d);
|
mDecompositionQ.push(d);
|
||||||
|
mDecompositionQMutex->unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -1252,7 +1262,9 @@ bool LLMeshRepoThread::physicsShapeReceived(const LLUUID& mesh_id, U8* data, S32
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mDecompositionQMutex->lock();
|
||||||
mDecompositionQ.push(d);
|
mDecompositionQ.push(d);
|
||||||
|
mDecompositionQMutex->unlock();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1862,14 +1874,22 @@ void LLMeshRepoThread::notifyLoadedMeshes()
|
|||||||
|
|
||||||
while (!mSkinInfoQ.empty())
|
while (!mSkinInfoQ.empty())
|
||||||
{
|
{
|
||||||
gMeshRepo.notifySkinInfoReceived(mSkinInfoQ.front());
|
mSkinInfoQMutex->lock();
|
||||||
|
auto req = mSkinInfoQ.front();
|
||||||
mSkinInfoQ.pop();
|
mSkinInfoQ.pop();
|
||||||
|
mSkinInfoQMutex->unlock();
|
||||||
|
|
||||||
|
gMeshRepo.notifySkinInfoReceived(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!mDecompositionQ.empty())
|
while (!mDecompositionQ.empty())
|
||||||
{
|
{
|
||||||
gMeshRepo.notifyDecompositionReceived(mDecompositionQ.front());
|
mDecompositionQMutex->lock();
|
||||||
|
auto req = mDecompositionQ.front();
|
||||||
mDecompositionQ.pop();
|
mDecompositionQ.pop();
|
||||||
|
mDecompositionQMutex->unlock();
|
||||||
|
|
||||||
|
gMeshRepo.notifyDecompositionReceived(req);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -265,6 +265,7 @@ public:
|
|||||||
|
|
||||||
//queue of completed skin info requests
|
//queue of completed skin info requests
|
||||||
std::queue<LLMeshSkinInfo> mSkinInfoQ;
|
std::queue<LLMeshSkinInfo> mSkinInfoQ;
|
||||||
|
LLMutex* mSkinInfoQMutex;
|
||||||
|
|
||||||
//set of requested decompositions
|
//set of requested decompositions
|
||||||
uuid_set_t mDecompositionRequests;
|
uuid_set_t mDecompositionRequests;
|
||||||
@@ -274,6 +275,7 @@ public:
|
|||||||
|
|
||||||
//queue of completed Decomposition info requests
|
//queue of completed Decomposition info requests
|
||||||
std::queue<LLModel::Decomposition*> mDecompositionQ;
|
std::queue<LLModel::Decomposition*> mDecompositionQ;
|
||||||
|
LLMutex* mDecompositionQMutex;
|
||||||
|
|
||||||
//queue of requested headers
|
//queue of requested headers
|
||||||
std::deque<std::pair<std::shared_ptr<MeshRequest>, F32> > mHeaderReqQ;
|
std::deque<std::pair<std::shared_ptr<MeshRequest>, F32> > mHeaderReqQ;
|
||||||
|
|||||||
Reference in New Issue
Block a user