THRIFT-1584 could not SetMinThreads in ThreadPool on single-core machines
Client: C#
Patch: Jens Geyer after suggestion from JIRA-User "Funny"
diff --git a/lib/csharp/src/Server/TThreadPoolServer.cs b/lib/csharp/src/Server/TThreadPoolServer.cs
index b257fd8..7ddabf7 100644
--- a/lib/csharp/src/Server/TThreadPoolServer.cs
+++ b/lib/csharp/src/Server/TThreadPoolServer.cs
@@ -75,16 +75,16 @@
:base(processor, serverTransport, inputTransportFactory, outputTransportFactory,
inputProtocolFactory, outputProtocolFactory, logDel)
{
- lock (typeof(TThreadPoolServer))
- {
- if (!ThreadPool.SetMinThreads(minThreadPoolThreads, minThreadPoolThreads))
- {
- throw new Exception("Error: could not SetMinThreads in ThreadPool");
- }
- if (!ThreadPool.SetMaxThreads(maxThreadPoolThreads, maxThreadPoolThreads))
- {
- throw new Exception("Error: could not SetMaxThreads in ThreadPool");
- }
+ lock (typeof(TThreadPoolServer))
+ {
+ if (!ThreadPool.SetMaxThreads(maxThreadPoolThreads, maxThreadPoolThreads))
+ {
+ throw new Exception("Error: could not SetMaxThreads in ThreadPool");
+ }
+ if (!ThreadPool.SetMinThreads(minThreadPoolThreads, minThreadPoolThreads))
+ {
+ throw new Exception("Error: could not SetMinThreads in ThreadPool");
+ }
}
}