h2load: Enable kqueue if it is available in the running platform

This commit is contained in:
Tatsuhiro Tsujikawa 2016-05-06 23:40:55 +09:00
parent 60e443b90b
commit c6facaf662
1 changed files with 11 additions and 1 deletions

View File

@ -1136,10 +1136,20 @@ void Client::signal_write() { ev_io_start(worker->loop, &wev); }
void Client::try_new_connection() { new_connection_requested = true; }
namespace {
int get_ev_loop_flags() {
if (ev_supported_backends() & ~ev_recommended_backends() & EVBACKEND_KQUEUE) {
return ev_recommended_backends() | EVBACKEND_KQUEUE;
}
return 0;
}
} // namespace
Worker::Worker(uint32_t id, SSL_CTX *ssl_ctx, size_t req_todo, size_t nclients,
size_t rate, size_t max_samples, Config *config)
: stats(req_todo, nclients),
loop(ev_loop_new(0)),
loop(ev_loop_new(get_ev_loop_flags())),
ssl_ctx(ssl_ctx),
config(config),
id(id),