diff options
author | Jose <jose@zeroc.com> | 2017-05-04 10:52:31 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2017-05-04 10:52:31 +0200 |
commit | a34e4fc8e9cc695e72305c2e460ea4e4dee5133f (patch) | |
tree | 5c6445e425d1fc0cfd937b3fb383fe1d4a3c0a69 /csharp/src/Ice/ThreadPool.cs | |
parent | Generate alias for "delegate" in C++11 (ICE-7859) (diff) | |
download | ice-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.cs | 15 |
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(); |