From: Jens Geyer Date: Wed, 28 May 2014 20:31:23 +0000 (+0200) Subject: THRIFT-1584 could not SetMinThreads in ThreadPool on single-core machines X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=4b0fede142950c31ac04460221021ebc2800c0db;p=common%2Fthrift.git 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 b257fd8f..7ddabf7d 100644 --- a/lib/csharp/src/Server/TThreadPoolServer.cs +++ b/lib/csharp/src/Server/TThreadPoolServer.cs @@ -75,16 +75,16 @@ namespace Thrift.Server :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"); + } } }