Skip to content

Commit

Permalink
Merge #12923: util: Pass pthread_self() to pthread_setschedparam inst…
Browse files Browse the repository at this point in the history
…ead of 0

Summary:
b86730a util: Remove designator initializer from ScheduleBatchPriority (Wladimir J. van der Laan)
cff66e6 util: Pass pthread_self() to pthread_setschedparam instead of 0 (Wladimir J. van der Laan)

Pull request description:

  Nowhere in the man page of `pthread_setschedparam` it is mentioned that `0` is a valid value. The example uses `pthread_self()`, so should we.

  (noticed by Anthony Towns)
  Fixes #12915.

Tree-SHA512: 249e93b1ae7e3ba28de6ee6288400b91d21ca1b4ca41d82211f6c9609b62deb5ac87182c7bf08471d3a3e0c1af314c9ecd41f8ae864febe963b1de8a816dd82f

Backport of Core PR12923
bitcoin/bitcoin#12923

Depends on D3953

Test Plan:
  make check
  test_runner.py

Reviewers: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: deadalnix, O1 Bitcoin ABC, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D3954
  • Loading branch information
laanwj authored and Nico Guiton committed Aug 29, 2019
1 parent 5127de5 commit a402ac1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1315,8 +1315,8 @@ fs::path AbsPathForConfigVal(const fs::path &path, bool net_specific) {

int ScheduleBatchPriority() {
#ifdef SCHED_BATCH
const static sched_param param{.sched_priority = 0};
if (int ret = pthread_setschedparam(0, SCHED_BATCH, &param)) {
const static sched_param param{0};
if (int ret = pthread_setschedparam(pthread_self(), SCHED_BATCH, &param)) {
LogPrintf("Failed to pthread_setschedparam: %s\n", strerror(errno));
return ret;
}
Expand Down

0 comments on commit a402ac1

Please sign in to comment.