/root/bitcoin/src/util/batchpriority.cpp
Line | Count | Source |
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 | | |
17 | | void ScheduleBatchPriority() |
18 | 0 | { |
19 | 0 | #ifdef SCHED_BATCH |
20 | 0 | const static sched_param param{}; |
21 | 0 | const int rc = pthread_setschedparam(pthread_self(), SCHED_BATCH, ¶m); |
22 | 0 | if (rc != 0) { |
23 | 0 | LogWarning("Failed to pthread_setschedparam: %s", SysErrorString(rc));Line | Count | Source | 96 | 0 | #define LogWarning(...) LogPrintLevel_(BCLog::LogFlags::ALL, BCLog::Level::Warning, /*should_ratelimit=*/true, __VA_ARGS__) Line | Count | Source | 89 | 0 | #define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(SourceLocation{__func__}, category, level, should_ratelimit, __VA_ARGS__) |
|
|
24 | 0 | } |
25 | 0 | #endif |
26 | 0 | } |