util: make ScheduleBatchPriority advisory only

This commit is contained in:
fanquake committed 2019-11-26 09:55:07 -05:00
1 parent 0ee914ba9e
commit d2a3a5cadb
2 files changed
+3 -9

No files matched your search

+2 -6
View File
@@ -1126,17 +1126,13 @@ fs::path AbsPathForConfigVal(const fs::path& path, bool net_specific)
return fs::absolute(path, GetDataDir(net_specific)); return fs::absolute(path, GetDataDir(net_specific));
} }
int ScheduleBatchPriority() void ScheduleBatchPriority()
{ {
#ifdef SCHED_BATCH #ifdef SCHED_BATCH
const static sched_param param{}; const static sched_param param{};
if (int ret = pthread_setschedparam(pthread_self(), SCHED_BATCH, &param)) { if (pthread_setschedparam(pthread_self(), SCHED_BATCH, &param) != 0) {
LogPrintf("Failed to pthread_setschedparam: %s\n", strerror(errno)); LogPrintf("Failed to pthread_setschedparam: %s\n", strerror(errno));
return ret;
} }
return 0;
#else
return 1;
#endif #endif
} }
+1 -3
View File
@@ -367,10 +367,8 @@ std::string CopyrightHolders(const std::string& strPrefix);
* On platforms that support it, tell the kernel the calling thread is * On platforms that support it, tell the kernel the calling thread is
* CPU-intensive and non-interactive. See SCHED_BATCH in sched(7) for details. * CPU-intensive and non-interactive. See SCHED_BATCH in sched(7) for details.
* *
* @return The return value of sched_setschedule(), or 1 on systems without
* sched_setschedule().
*/ */
int ScheduleBatchPriority(); void ScheduleBatchPriority();
namespace util { namespace util {