fix: update asio-sv.cc to use new callback

This commit is contained in:
Jacky_Yin 2021-08-16 19:56:46 +08:00
parent d7f98c48d1
commit ff1b961c5b
1 changed files with 9 additions and 0 deletions

View File

@ -42,6 +42,13 @@
using namespace nghttp2::asio_http2;
using namespace nghttp2::asio_http2::server;
void all_threads_created_cb(
std::vector<std::shared_ptr<thread_info>> all_threads_info) {
for (auto thread_info : all_threads_info) {
std::cout << "thread pid: " << thread_info->pid << std::endl;
}
}
int main(int argc, char *argv[]) {
try {
// Check command line arguments.
@ -62,6 +69,8 @@ int main(int argc, char *argv[]) {
server.num_threads(num_threads);
server.set_on_all_threads_created_callback(all_threads_created_cb);
server.handle("/", [](const request &req, const response &res) {
res.write_head(200, {{"foo", {"bar"}}});
res.end("hello, world\n");