소스 검색

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

Matthieu Garrigues 5 년 전
부모
커밋
05d85d9457
3개의 변경된 파일5개의 추가작업 그리고 5개의 파일을 삭제
  1. 1 1
      frameworks/C++/lithium/lithium-mysql.dockerfile
  2. 1 1
      frameworks/C++/lithium/lithium-postgres.dockerfile
  3. 3 3
      frameworks/C++/lithium/lithium.cc

+ 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 =