From ba8b07387ca67f4b8a288c217c5bfea94c61a42c Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Mon, 20 Feb 2012 18:44:02 +0000 Subject: [PATCH] Issue 317: increase priority of the master thread --- mongoose.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mongoose.c b/mongoose.c index cb280abd..f95f85ad 100644 --- a/mongoose.c +++ b/mongoose.c @@ -4029,6 +4029,15 @@ static void master_thread(struct mg_context *ctx) { struct socket *sp; int max_fd; +#if defined(ISSUE_317) + // Increase priority of the master thread + struct sched_param sched_param; + int policy; + pthread_getschedparam(pthread_self(), &policy, &sched_param); + sched_param.sched_priority = sched_get_priority_max(policy); + pthread_setschedparam(pthread_self(), policy, &sched_param); +#endif + while (ctx->stop_flag == 0) { FD_ZERO(&read_set); max_fd = -1;