diff options
author | Benoit Foucher <benoit@zeroc.com> | 2024-07-01 12:09:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-01 12:09:49 +0200 |
commit | bccededabd0c0814b2ede9cf232e9c23ed8f1eb4 (patch) | |
tree | d66acd30d0d1affb777108a099b5cd868f7060d5 | |
parent | Back pressure fix for 3.7 (#2270) (diff) | |
download | ice-bccededabd0c0814b2ede9cf232e9c23ed8f1eb4.tar.bz2 ice-bccededabd0c0814b2ede9cf232e9c23ed8f1eb4.tar.xz ice-bccededabd0c0814b2ede9cf232e9c23ed8f1eb4.zip |
Additional C# thread pool fixes (#2372)
-rw-r--r-- | csharp/src/Ice/ConnectionFactory.cs | 4 | ||||
-rw-r--r-- | csharp/src/Ice/ConnectionI.cs | 9 | ||||
-rw-r--r-- | csharp/src/Ice/EventHandler.cs | 4 | ||||
-rw-r--r-- | csharp/src/Ice/ThreadPool.cs | 4 |
4 files changed, 13 insertions, 8 deletions
diff --git a/csharp/src/Ice/ConnectionFactory.cs b/csharp/src/Ice/ConnectionFactory.cs index 20c9e4dbe25..b59751d840d 100644 --- a/csharp/src/Ice/ConnectionFactory.cs +++ b/csharp/src/Ice/ConnectionFactory.cs @@ -1401,7 +1401,7 @@ namespace IceInternal return _state < StateClosed; } - public override void message(ref ThreadPoolCurrent current) + public override void message(ThreadPoolCurrent current) { Ice.ConnectionI connection = null; @@ -1522,7 +1522,7 @@ namespace IceInternal connection.start(this); } - public override void finished(ref ThreadPoolCurrent current) + public override void finished(ThreadPoolCurrent current) { lock(this) { diff --git a/csharp/src/Ice/ConnectionI.cs b/csharp/src/Ice/ConnectionI.cs index 8c7b0c9fa11..61f0970e859 100644 --- a/csharp/src/Ice/ConnectionI.cs +++ b/csharp/src/Ice/ConnectionI.cs @@ -1102,6 +1102,11 @@ namespace Ice public override bool finishAsync(int operation) { + if(_state >= StateClosed) + { + return false; + } + try { if((operation & SocketOperation.Write) != 0) @@ -1168,7 +1173,7 @@ namespace Ice return _state < StateClosed; } - public override void message(ref ThreadPoolCurrent current) + public override void message(ThreadPoolCurrent current) { StartCallback startCB = null; Queue<OutgoingMessage> sentCBs = null; @@ -1560,7 +1565,7 @@ namespace Ice } } - public override void finished(ref ThreadPoolCurrent current) + public override void finished(ThreadPoolCurrent current) { lock(this) { diff --git a/csharp/src/Ice/EventHandler.cs b/csharp/src/Ice/EventHandler.cs index c4d5d4d82a7..6b5e15470e8 100644 --- a/csharp/src/Ice/EventHandler.cs +++ b/csharp/src/Ice/EventHandler.cs @@ -17,12 +17,12 @@ public abstract class EventHandler // // Called when there's a message ready to be processed. // - abstract public void message(ref ThreadPoolCurrent op); + abstract public void message(ThreadPoolCurrent op); // // Called when the event handler is unregistered. // - abstract public void finished(ref ThreadPoolCurrent op); + abstract public void finished(ThreadPoolCurrent op); internal int _ready = 0; internal int _pending = 0; diff --git a/csharp/src/Ice/ThreadPool.cs b/csharp/src/Ice/ThreadPool.cs index c113ec1ab57..467c5bdfdbf 100644 --- a/csharp/src/Ice/ThreadPool.cs +++ b/csharp/src/Ice/ThreadPool.cs @@ -361,7 +361,7 @@ namespace IceInternal { current.operation = SocketOperation.None; current._handler = handler; - handler.finished(ref current); + handler.finished(current); }); Monitor.Pulse(this); } @@ -472,7 +472,7 @@ namespace IceInternal current.operation = operation; try { - current._handler.message(ref current); + current._handler.message(current); } catch(System.Exception ex) { |