Skip to content

Commit 8a18970

Browse files
committed
moved unsafe thread joins to out of signal handler
1 parent 6091550 commit 8a18970

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

examples/server/server.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ void terminate(worker_pool * pool) {
286286
(*pool)[0]->task_queue->terminate();
287287
(*pool)[0]->response_map->terminate();
288288
}
289+
}
290+
291+
void complete(worker_pool * pool) {
289292
for (auto w : *pool) {
290293
if (w->thread) {
291294
w->thread->join();
@@ -705,7 +708,9 @@ int main(int argc, const char ** argv) {
705708
fprintf(stdout, "%s: HTTP server listening on hostname: %s and port: %d, is shutting down.\n", __func__, args.get_string_param("--host").c_str(), *args.get_int_param("--port"));
706709
svr->stop();
707710
t.join();
711+
complete(pool);
708712
rmap->cleanup_thread->join();
709713

714+
710715
return 0;
711716
}

0 commit comments

Comments
 (0)