- remove left-overs from OpenMP
- replace omp_* calls with TBB equivalents
This commit is contained in:
Dennis Luxen
2014-05-22 18:24:11 +02:00
parent 20cbfd95d6
commit 6a03f13d55
8 changed files with 7 additions and 53 deletions
+4 -3
View File
@@ -29,7 +29,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define SERVER_FACTORY_H
#include "Server.h"
#include "../Util/OpenMPWrapper.h"
#include "../Util/SimpleLogger.h"
#include "../Util/StringUtil.h"
@@ -39,11 +38,13 @@ struct ServerFactory
{
ServerFactory() = delete;
ServerFactory(const ServerFactory &) = delete;
static Server *CreateServer(std::string &ip_address, int ip_port, int threads)
static Server *CreateServer(std::string &ip_address, int ip_port, unsigned requested_num_threads)
{
SimpleLogger().Write() << "http 1.1 compression handled by zlib version " << zlibVersion();
std::string port_stream = IntToString(ip_port);
return new Server(ip_address, port_stream, std::min(omp_get_num_procs(), threads));
unsigned hardware_threads = std::max(1u, std::thread::hardware_concurrency());
unsigned real_num_threads = std::min(hardware_threads, requested_num_threads);
return new Server(ip_address, port_stream, real_num_threads);
}
};