summaryrefslogtreecommitdiff
path: root/csharp/src/Ice/ThreadPool.cs
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2017-05-04 10:52:31 +0200
committerJose <jose@zeroc.com>2017-05-04 10:52:31 +0200
commita34e4fc8e9cc695e72305c2e460ea4e4dee5133f (patch)
tree5c6445e425d1fc0cfd937b3fb383fe1d4a3c0a69 /csharp/src/Ice/ThreadPool.cs
parentGenerate alias for "delegate" in C++11 (ICE-7859) (diff)
downloadice-a34e4fc8e9cc695e72305c2e460ea4e4dee5133f.tar.bz2
ice-a34e4fc8e9cc695e72305c2e460ea4e4dee5133f.tar.xz
ice-a34e4fc8e9cc695e72305c2e460ea4e4dee5133f.zip
Improve ice_executor and ice_scheduler to use Ice.Dispatcher
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();