ping: increase ping work thread priority

This commit is contained in:
Nick Peng
2022-11-16 22:11:18 +08:00
parent f6b9a1b81a
commit bc379a3c3e
2 changed files with 14 additions and 0 deletions

View File

@@ -1762,6 +1762,8 @@ static void *_fast_ping_work(void *arg)
int sleep_time = 0;
unsigned long expect_time = 0;
setpriority(PRIO_PROCESS, 0, -5);
sleep_time = sleep;
now = get_tick_count() - sleep;
last = now;

View File

@@ -40,6 +40,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/prctl.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <ucontext.h>
@@ -512,10 +513,21 @@ static int _smartdns_create_logdir(void)
return 0;
}
static int _set_rlimit(void)
{
struct rlimit value;
value.rlim_cur = 40;
value.rlim_max = 40;
setrlimit(RLIMIT_NICE, &value);
return 0;
}
static int _smartdns_init_pre(void)
{
_smartdns_create_logdir();
_set_rlimit();
return 0;
}