summaryrefslogtreecommitdiff
path: root/csharp/src
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2017-05-03 10:39:58 +0200
committerJose <jose@zeroc.com>2017-05-03 10:39:58 +0200
commitac031c312bf536898422b9e700d7f7210f8ca77b (patch)
treef9ca89b05aa4754aac3b3df62bc721b10b1c4632 /csharp/src
parentRemoved trailing whitespace from code generated by slice2cs (diff)
downloadice-ac031c312bf536898422b9e700d7f7210f8ca77b.tar.bz2
ice-ac031c312bf536898422b9e700d7f7210f8ca77b.tar.xz
ice-ac031c312bf536898422b9e700d7f7210f8ca77b.zip
Fix (ICE-7839) - C++ AMI thread behavior in C#, Java and Python
Diffstat (limited to 'csharp/src')
-rw-r--r--csharp/src/Ice/ConnectionI.cs5
-rw-r--r--csharp/src/Ice/Proxy.cs12
-rw-r--r--csharp/src/Ice/Reference.cs11
-rw-r--r--csharp/src/Ice/ThreadPool.cs22
4 files changed, 49 insertions, 1 deletions
diff --git a/csharp/src/Ice/ConnectionI.cs b/csharp/src/Ice/ConnectionI.cs
index 1f02c48b6fb..4f348437e76 100644
--- a/csharp/src/Ice/ConnectionI.cs
+++ b/csharp/src/Ice/ConnectionI.cs
@@ -1746,6 +1746,11 @@ namespace Ice
}
}
+ public IceInternal.ThreadPool getThreadPool()
+ {
+ return _threadPool;
+ }
+
static ConnectionI()
{
_compressionSupported = IceInternal.BZip2.supported();
diff --git a/csharp/src/Ice/Proxy.cs b/csharp/src/Ice/Proxy.cs
index cd304fd4299..5ebeb1f6a9d 100644
--- a/csharp/src/Ice/Proxy.cs
+++ b/csharp/src/Ice/Proxy.cs
@@ -770,6 +770,13 @@ namespace Ice
/// <param name="os">Output stream object to write the proxy.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
void iceWrite(OutputStream os);
+
+
+ /// <summary>
+ /// Returns an scheduler object that use the Ice thread pool.
+ /// </summary>
+ /// <returns>The task scheduler object.</returns>
+ System.Threading.Tasks.TaskScheduler ice_scheduler();
}
/// <summary>
@@ -2352,6 +2359,11 @@ namespace Ice
resultI.wait();
}
+ public System.Threading.Tasks.TaskScheduler ice_scheduler()
+ {
+ return _reference.getThreadPool();
+ }
+
/// <summary>
/// Returns whether this proxy equals the passed object. Two proxies are equal if they are equal in all
/// respects, that is, if their object identity, endpoints timeout settings, and so on are all equal.
diff --git a/csharp/src/Ice/Reference.cs b/csharp/src/Ice/Reference.cs
index 80b985544db..a27d37b2958 100644
--- a/csharp/src/Ice/Reference.cs
+++ b/csharp/src/Ice/Reference.cs
@@ -93,6 +93,7 @@ namespace IceInternal
public abstract Ice.EndpointSelectionType getEndpointSelection();
public abstract int getLocatorCacheTimeout();
public abstract string getConnectionId();
+ public abstract ThreadPool getThreadPool();
//
// The change* methods (here and in derived classes) create
@@ -606,6 +607,11 @@ namespace IceInternal
return "";
}
+ public override ThreadPool getThreadPool()
+ {
+ return _fixedConnection.getThreadPool();
+ }
+
public override Reference changeEndpoints(EndpointI[] newEndpoints)
{
throw new Ice.FixedProxyException();
@@ -828,6 +834,11 @@ namespace IceInternal
return _connectionId;
}
+ public override ThreadPool getThreadPool()
+ {
+ return getInstance().clientThreadPool();
+ }
+
public override Reference changeEncoding(Ice.EncodingVersion newEncoding)
{
RoutableReference r = (RoutableReference)base.changeEncoding(newEncoding);
diff --git a/csharp/src/Ice/ThreadPool.cs b/csharp/src/Ice/ThreadPool.cs
index 226a0f9a04a..0f3cdfcfcad 100644
--- a/csharp/src/Ice/ThreadPool.cs
+++ b/csharp/src/Ice/ThreadPool.cs
@@ -154,7 +154,7 @@ namespace IceInternal
internal readonly EventHandler _handler;
}
- public sealed class ThreadPool
+ public sealed class ThreadPool : System.Threading.Tasks.TaskScheduler
{
public ThreadPool(Instance instance, string prefix, int timeout)
{
@@ -486,6 +486,26 @@ namespace IceInternal
return _serialize;
}
+ protected sealed override void QueueTask(System.Threading.Tasks.Task task)
+ {
+ dispatch(() => { TryExecuteTask(task); }, null, false);
+ }
+
+ protected sealed override bool TryExecuteTaskInline(System.Threading.Tasks.Task task, bool taskWasPreviouslyQueued)
+ {
+ return false;
+ }
+
+ protected sealed override bool TryDequeue(System.Threading.Tasks.Task task)
+ {
+ return false;
+ }
+
+ protected sealed override IEnumerable<System.Threading.Tasks.Task> GetScheduledTasks()
+ {
+ return new System.Threading.Tasks.Task[0];
+ }
+
private void run(WorkerThread thread)
{
ThreadPoolWorkItem workItem = null;