// launch MHD with MHD_USE_EPOLL (and NOT any "INTERNAL_THREAD") { int fd; fd = MHD_get_daemon_info (daemon, MHD_DAEMON_INFO_EPOLL_FD)->epoll_fd; while (1) { fd_set r; MHD_UNSIGNED_LONG_LONG to; struct timeval tv; FD_ZERO (&r); FD_SET (fd, &r); MHD_get_timeout (daemon, &to); tv.tv_sec = (to / 1000LLU); tv.tv_usec = (to % 1000LLU) * 1000; select (r + 1, &r, NULL, NULL, NULL); MHD_run (daemon); } }