possible multithreading issues

This commit is contained in:
UbitUmarov
2021-10-12 18:08:49 +01:00
parent 042c49385f
commit c71181ff51
2 changed files with 21 additions and 6 deletions

View File

@@ -141,10 +141,9 @@ namespace OpenSim.Framework
if (!m_isRunning)
return false;
m_jobQueue?.Add(o);
lock (m_mainLock)
{
m_jobQueue?.Add(o);
if (m_numberThreads < m_concurrency && m_numberThreads < m_jobQueue.Count)
{
Util.FireAndForget(ProcessRequests, null, m_name, false);
@@ -162,7 +161,15 @@ namespace OpenSim.Framework
try
{
if(!m_jobQueue.TryTake(out obj, m_threadsHoldtime, m_cancelSource.Token))
break;
{
lock (m_mainLock)
{
if (m_jobQueue.Count > 0)
continue;
--m_numberThreads;
return;
}
}
}
catch
{