mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-28 07:28:13 +08:00
Increasing master thread priority on Windows
This commit is contained in:
parent
ba8b07387c
commit
b10b989865
12
mongoose.c
12
mongoose.c
@ -4029,13 +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
|
||||
#if defined(_WIN32)
|
||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
|
||||
#endif
|
||||
|
||||
#if defined(ISSUE_317)
|
||||
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);
|
||||
sched_param.sched_priority = sched_get_priority_max(SCHED_RR);
|
||||
pthread_setschedparam(pthread_self(), SCHED_RR, &sched_param);
|
||||
#endif
|
||||
|
||||
while (ctx->stop_flag == 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user