You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2011/12/28 20:01:15 UTC

svn commit: r1225293 - in /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x/src: main/csharp/Threads/ThreadPoolExecutor.cs test/csharp/AMQNET366Test.cs

Author: tabish
Date: Wed Dec 28 19:01:15 2011
New Revision: 1225293

URL: http://svn.apache.org/viewvc?rev=1225293&view=rev
Log:
fix for: https://issues.apache.org/jira/browse/AMQNET-366

Added:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x/src/test/csharp/AMQNET366Test.cs
      - copied unchanged from r1225279, activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/AMQNET366Test.cs
Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x/src/main/csharp/Threads/ThreadPoolExecutor.cs

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x/src/main/csharp/Threads/ThreadPoolExecutor.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x/src/main/csharp/Threads/ThreadPoolExecutor.cs?rev=1225293&r1=1225292&r2=1225293&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x/src/main/csharp/Threads/ThreadPoolExecutor.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x/src/main/csharp/Threads/ThreadPoolExecutor.cs Wed Dec 28 19:01:15 2011
@@ -35,6 +35,7 @@ namespace Apache.NMS.ActiveMQ.Threads
         private bool closing = false;
         private bool closed = false;
         private ManualResetEvent executionComplete = new ManualResetEvent(true);
+        private Thread workThread = null;
 
         /// <summary>
         /// Represents an asynchronous task that is executed on the ThreadPool
@@ -115,7 +116,7 @@ namespace Apache.NMS.ActiveMQ.Threads
                     this.closing = true;
                     this.workQueue.Clear();
 
-                    if(this.running)
+                    if(this.running && Thread.CurrentThread != this.workThread)
                     {
                         syncRoot.ReleaseMutex();
                         this.executionComplete.WaitOne();
@@ -135,6 +136,8 @@ namespace Apache.NMS.ActiveMQ.Threads
 
             lock(syncRoot)
             {
+                this.workThread = Thread.CurrentThread;
+
                 if(this.workQueue.Count == 0 || this.closing)
                 {
                     this.running = false;
@@ -151,6 +154,8 @@ namespace Apache.NMS.ActiveMQ.Threads
             }
             finally
             {
+                this.workThread = null;
+
                 if(this.closing)
                 {
                     this.running = false;