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
|
#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 //
|
// Callback thread //
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -283,6 +292,7 @@ DWORD WINAPI _zts_run_callbacks(LPVOID thread_id)
|
|||||||
void *_zts_run_callbacks(void *thread_id)
|
void *_zts_run_callbacks(void *thread_id)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
_change_nice(CALLBACK_THREAD_NICENESS);
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
pthread_setname_np(ZTS_EVENT_CALLBACK_THREAD_NAME);
|
pthread_setname_np(ZTS_EVENT_CALLBACK_THREAD_NAME);
|
||||||
#endif
|
#endif
|
||||||
@@ -318,7 +328,9 @@ void *_zts_run_service(void *arg)
|
|||||||
//struct serviceParameters *params = arg;
|
//struct serviceParameters *params = arg;
|
||||||
//DEBUG_INFO("path=%s", params->path.c_str());
|
//DEBUG_INFO("path=%s", params->path.c_str());
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
_change_nice(SERVICE_THREAD_NICENESS);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
std::vector<std::string> hpsp(OSUtils::split(_path.c_str(), ZT_PATH_SEPARATOR_S,"",""));
|
std::vector<std::string> hpsp(OSUtils::split(_path.c_str(), ZT_PATH_SEPARATOR_S,"",""));
|
||||||
std::string ptmp;
|
std::string ptmp;
|
||||||
|
|||||||
@@ -32,9 +32,15 @@
|
|||||||
#define ZTS_HIBERNATION_MULTIPLIER 50
|
#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_SERVICE_THREAD_NAME "ZeroTierServiceThread"
|
||||||
#define ZTS_EVENT_CALLBACK_THREAD_NAME "ZeroTierEventCallbackThread"
|
#define ZTS_EVENT_CALLBACK_THREAD_NAME "ZeroTierEventCallbackThread"
|
||||||
#define ZTS_LWIP_DRIVER_THREAD_NAME "lwipDriver"
|
#define ZTS_LWIP_DRIVER_THREAD_NAME "lwipDriver"
|
||||||
|
|||||||
Reference in New Issue
Block a user