Commit 15a9dfba authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpd: Enable kqueue if it is available on the running platform

parent c6facaf6
......@@ -1793,6 +1793,16 @@ void run_worker(Worker *worker) {
}
} // namespace
namespace {
int get_ev_loop_flags() {
if (ev_supported_backends() & ~ev_recommended_backends() & EVBACKEND_KQUEUE) {
return ev_recommended_backends() | EVBACKEND_KQUEUE;
}
return 0;
}
} // namespace
class AcceptHandler {
public:
AcceptHandler(HttpServer *sv, Sessions *sessions, const Config *config)
......@@ -1805,7 +1815,7 @@ public:
std::cerr << "spawning thread #" << i << std::endl;
}
auto worker = make_unique<Worker>();
auto loop = ev_loop_new(0);
auto loop = ev_loop_new(get_ev_loop_flags());
worker->sessions =
make_unique<Sessions>(sv, loop, config_, sessions_->get_ssl_ctx());
ev_async_init(&worker->w, worker_acceptcb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment