Added _change_nice(), and options in src/Options.h
This commit is contained in:
@@ -273,6 +273,15 @@ void _api_sleep(int interval_ms)
|
||||
#endif
|
||||
}
|
||||
|
||||
int _change_nice(int increment)
|
||||
{
|
||||
if (increment == 0) {
|
||||
return 0;
|
||||
}
|
||||
int priority = getpriority(PRIO_PROCESS, 0);
|
||||
return setpriority( PRIO_PROCESS, 0, priority+increment);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Callback thread //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -283,6 +292,7 @@ DWORD WINAPI _zts_run_callbacks(LPVOID thread_id)
|
||||
void *_zts_run_callbacks(void *thread_id)
|
||||
#endif
|
||||
{
|
||||
_change_nice(CALLBACK_THREAD_NICENESS);
|
||||
#if defined(__APPLE__)
|
||||
pthread_setname_np(ZTS_EVENT_CALLBACK_THREAD_NAME);
|
||||
#endif
|
||||
@@ -319,6 +329,8 @@ void *_zts_run_service(void *arg)
|
||||
//DEBUG_INFO("path=%s", params->path.c_str());
|
||||
int err;
|
||||
|
||||
_change_nice(SERVICE_THREAD_NICENESS);
|
||||
|
||||
try {
|
||||
std::vector<std::string> hpsp(OSUtils::split(_path.c_str(), ZT_PATH_SEPARATOR_S,"",""));
|
||||
std::string ptmp;
|
||||
|
||||
@@ -32,9 +32,15 @@
|
||||
#define ZTS_HIBERNATION_MULTIPLIER 50
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Thread names //
|
||||
// Threading //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define SERVICE_THREAD_NICENESS 0 // -10
|
||||
#define CALLBACK_THREAD_NICENESS 0 // 10
|
||||
#define LWIP_DRIVER_THREAD_NICENESS 0 // 10
|
||||
#define TCPIP_THREAD_NICENESS 0 // -10
|
||||
#define TAP_THREAD_NICENESS 0 // 10
|
||||
|
||||
#define ZTS_SERVICE_THREAD_NAME "ZeroTierServiceThread"
|
||||
#define ZTS_EVENT_CALLBACK_THREAD_NAME "ZeroTierEventCallbackThread"
|
||||
#define ZTS_LWIP_DRIVER_THREAD_NAME "lwipDriver"
|
||||
|
||||
Reference in New Issue
Block a user