mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 14:16:07 +08:00
While examining our 10,10,10 issue I discovered that several threads were locked with each other in an unusual place; I've moved the piece of code inside a lock[] context and so far it's looking promising.
This commit is contained in:
13
ThirdParty/SmartThreadPool/SmartThreadPool.cs
vendored
13
ThirdParty/SmartThreadPool/SmartThreadPool.cs
vendored
@@ -535,17 +535,10 @@ namespace Amib.Threading
|
||||
// Process until shutdown.
|
||||
while(!_shutdown)
|
||||
{
|
||||
// Update the last time this thread was seen alive.
|
||||
// It's good for debugging.
|
||||
_workerThreads[Thread.CurrentThread] = DateTime.Now;
|
||||
|
||||
|
||||
// Wait for a work item, shutdown, or timeout
|
||||
WorkItem workItem = Dequeue();
|
||||
|
||||
// Update the last time this thread was seen alive.
|
||||
// It's good for debugging.
|
||||
_workerThreads[Thread.CurrentThread] = DateTime.Now;
|
||||
|
||||
// On timeout or shut down.
|
||||
if (null == workItem)
|
||||
{
|
||||
@@ -554,6 +547,10 @@ namespace Amib.Threading
|
||||
{
|
||||
lock(_workerThreads.SyncRoot)
|
||||
{
|
||||
// Update the last time this thread was seen alive.
|
||||
// It's good for debugging.
|
||||
_workerThreads[Thread.CurrentThread] = DateTime.Now;
|
||||
|
||||
if (_workerThreads.Count > _stpStartInfo.MinWorkerThreads)
|
||||
{
|
||||
// Inform that the thread is quiting and then quit.
|
||||
|
||||
Reference in New Issue
Block a user