Bitcoin Core  31.0.0
P2P Digital Currency
batchpriority.cpp
Go to the documentation of this file.
1 // Copyright (c) 2023-present The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include <util/batchpriority.h>
6 
7 #include <util/log.h>
8 #include <util/syserror.h>
9 
10 #include <string>
11 
12 #ifndef WIN32
13 #include <pthread.h>
14 #include <sched.h>
15 #endif
16 
18 {
19 #ifdef SCHED_BATCH
20  const static sched_param param{};
21  const int rc = pthread_setschedparam(pthread_self(), SCHED_BATCH, &param);
22  if (rc != 0) {
23  LogWarning("Failed to pthread_setschedparam: %s", SysErrorString(rc));
24  }
25 #endif
26 }
#define LogWarning(...)
Definition: log.h:96
std::string SysErrorString(int err)
Return system error string from errno value.
Definition: syserror.cpp:17
void ScheduleBatchPriority()
On platforms that support it, tell the kernel the calling thread is CPU-intensive and non-interactive...