summaryrefslogtreecommitdiff
path: root/csharp/src/Ice/ThreadPool.cs
diff options
context:
space:
mode:
Diffstat (limited to 'csharp/src/Ice/ThreadPool.cs')
-rw-r--r--csharp/src/Ice/ThreadPool.cs15
1 files changed, 14 insertions, 1 deletions
diff --git a/csharp/src/Ice/ThreadPool.cs b/csharp/src/Ice/ThreadPool.cs
index d12308fba45..4d466590988 100644
--- a/csharp/src/Ice/ThreadPool.cs
+++ b/csharp/src/Ice/ThreadPool.cs
@@ -488,11 +488,19 @@ namespace IceInternal
protected sealed override void QueueTask(System.Threading.Tasks.Task task)
{
- dispatch(() => { TryExecuteTask(task); }, null, false);
+ dispatch(() => { TryExecuteTask(task); }, null, _dispatcher != null);
}
protected sealed override bool TryExecuteTaskInline(System.Threading.Tasks.Task task, bool taskWasPreviouslyQueued)
{
+ if(_dispatcher == null && !taskWasPreviouslyQueued)
+ {
+ if(_threads.Find(t => t.getThread().ManagedThreadId.Equals(Thread.CurrentThread.ManagedThreadId)) != null)
+ {
+ dispatchFromThisThread(() => { TryExecuteTask(task); }, null);
+ return true;
+ }
+ }
return false;
}
@@ -807,6 +815,11 @@ namespace IceInternal
_state = s;
}
+ public Thread getThread()
+ {
+ return _thread;
+ }
+
public void join()
{
_thread.Join();