diff options
Diffstat (limited to 'server/src/main.cpp')
| -rw-r--r-- | server/src/main.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/server/src/main.cpp b/server/src/main.cpp index 6e13c82..9d576a2 100644 --- a/server/src/main.cpp +++ b/server/src/main.cpp | |||
| @@ -137,7 +137,8 @@ auto server_main(routemon::log::logger& l, routemon::config::app config) | |||
| 137 | }; | 137 | }; |
| 138 | auto lsel = routemon::locale::selector{locales, default_locale}; | 138 | auto lsel = routemon::locale::selector{locales, default_locale}; |
| 139 | 139 | ||
| 140 | auto ioc = net::io_context{2 /* concurrency hint */}; | 140 | auto const nthread = 2uz; |
| 141 | auto ioc = net::io_context{nthread /* concurrency hint */}; | ||
| 141 | 142 | ||
| 142 | auto dbc = std::shared_ptr<routemon::database::connection>{}; | 143 | auto dbc = std::shared_ptr<routemon::database::connection>{}; |
| 143 | try | 144 | try |
| @@ -216,9 +217,13 @@ auto server_main(routemon::log::logger& l, routemon::config::app config) | |||
| 216 | }, | 217 | }, |
| 217 | net::detached); | 218 | net::detached); |
| 218 | 219 | ||
| 219 | ioc.run(); | 220 | auto threads = std::vector<std::thread>{nthread}; |
| 221 | for (auto& thread : threads) | ||
| 222 | thread = std::thread{[&ioc]() { ioc.run(); }}; | ||
| 223 | for (auto& thread : threads) | ||
| 224 | thread.join(); | ||
| 220 | 225 | ||
| 221 | l.error("I/O context stopped"); | 226 | l.error("I/O contexts stopped"); |
| 222 | return exit_status::failure; | 227 | return exit_status::failure; |
| 223 | } | 228 | } |
| 224 | 229 | ||