Parcourir la source

Lithium: Use std::thread::hardware_concurrency (#5389)

Matthieu Garrigues il y a 5 ans
Parent
commit
05d85d9457

+ 1 - 1
frameworks/C++/lithium/lithium-mysql.dockerfile

@@ -12,4 +12,4 @@ RUN wget https://raw.githubusercontent.com/matt-42/lithium/$COMMIT/single_header
 
 RUN g++ -DTFB_MYSQL -O3 -DNDEBUG -march=native -std=c++17 ./lithium.cc -I /usr/include/mariadb -lpthread -lmariadbclient -lboost_context -o /lithium_tbf
 
-CMD /lithium_tbf tfb-database 8080 $(nproc)
+CMD /lithium_tbf tfb-database 8080

+ 1 - 1
frameworks/C++/lithium/lithium-postgres.dockerfile

@@ -12,4 +12,4 @@ RUN wget https://raw.githubusercontent.com/matt-42/lithium/$COMMIT/single_header
 
 RUN g++ -DTFB_PGSQL -O3 -DNDEBUG -march=native -std=c++17 ./lithium.cc -I/usr/include/postgresql -lpthread -lpq -lboost_context -o /lithium_tbf
 
-CMD /lithium_tbf tfb-database 8080 $(nproc)
+CMD /lithium_tbf tfb-database 8080

+ 3 - 3
frameworks/C++/lithium/lithium.cc

@@ -26,14 +26,14 @@ void escape_html_entities(B& buffer, const std::string& data)
 
 int main(int argc, char* argv[]) {
 
-  if (argc != 4)
+  if (argc != 3)
   {
-    std::cerr << "Usage: " << argv[0] << " sql_host port nprocs" << std::endl;
+    std::cerr << "Usage: " << argv[0] << " sql_host port" << std::endl;
     return 1;
   }
 
   int port = atoi(argv[2]);
-  int nprocs = atoi(argv[3]);
+  int nprocs = std::thread::hardware_concurrency();
 
 #if TFB_MYSQL
   auto sql_db =