THRIFT-4190 Improve C# TThreadPoolServer defaults
Client: C#
Patch: Jens Geyer
This closes #1262
diff --git a/lib/csharp/src/Server/TThreadPoolServer.cs b/lib/csharp/src/Server/TThreadPoolServer.cs
index f0c7fe4..0010ece 100644
--- a/lib/csharp/src/Server/TThreadPoolServer.cs
+++ b/lib/csharp/src/Server/TThreadPoolServer.cs
@@ -87,13 +87,19 @@
{
lock (typeof(TThreadPoolServer))
{
- if (!ThreadPool.SetMaxThreads(maxThreadPoolThreads, maxThreadPoolThreads))
+ if(maxThreadPoolThreads > 0)
{
- throw new Exception("Error: could not SetMaxThreads in ThreadPool");
+ if (!ThreadPool.SetMaxThreads(maxThreadPoolThreads, maxThreadPoolThreads))
+ {
+ throw new Exception("Error: could not SetMaxThreads in ThreadPool");
+ }
}
- if (!ThreadPool.SetMinThreads(minThreadPoolThreads, minThreadPoolThreads))
+ if (minThreadPoolThreads > 0)
{
- throw new Exception("Error: could not SetMinThreads in ThreadPool");
+ if (!ThreadPool.SetMinThreads(minThreadPoolThreads, minThreadPoolThreads))
+ {
+ throw new Exception("Error: could not SetMinThreads in ThreadPool");
+ }
}
}
}