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.

avinationmerge
Tom Grimshaw 2010-05-18 00:07:17 -07:00
parent eb5a95d26b
commit ae7c30a0f3
1 changed files with 5 additions and 8 deletions

View File

@ -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.