Skip to content

Commit

Permalink
Minor cleanups, log fds (#1310)
Browse files Browse the repository at this point in the history
  • Loading branch information
prasannavl authored May 31, 2022
1 parent f3ad826 commit a2cf10b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
9 changes: 0 additions & 9 deletions src/scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,13 @@ void CScheduler::serviceQueue()

// Wait until either there is a new task, or until
// the time of the first item on the queue:

// wait_until needs boost 1.50 or later; older versions have timed_wait:
#if BOOST_VERSION < 105000
while (!shouldStop() && !taskQueue.empty() &&
newTaskScheduled.timed_wait(lock, toPosixTime(taskQueue.begin()->first))) {
// Keep waiting until timeout
}
#else
// Some boost versions have a conflicting overload of wait_until that returns void.
// Explicitly use a template here to avoid hitting that overload.
while (!shouldStop() && !taskQueue.empty()) {
boost::chrono::system_clock::time_point timeToWaitFor = taskQueue.begin()->first;
if (newTaskScheduled.wait_until<>(lock, timeToWaitFor) == boost::cv_status::timeout)
break; // Exit loop after timeout, it means we reached the time of the event
}
#endif
// If there are multiple threads, the queue can empty while we're waiting (another
// thread may service the task we were waiting on).
if (shouldStop() || taskQueue.empty())
Expand Down
3 changes: 3 additions & 0 deletions src/util/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1058,8 +1058,11 @@ int RaiseFileDescriptorLimit(int nMinFD) {
setrlimit(RLIMIT_NOFILE, &limitFD);
getrlimit(RLIMIT_NOFILE, &limitFD);
}
LogPrintf("conf: fd limit: req: %d, set %d, max: %d\n",
nMinFD, limitFD.rlim_cur, limitFD.rlim_max);
return limitFD.rlim_cur;
}
LogPrintf("conf: fd limit: %d, max: unknown\n", nMinFD);
return nMinFD; // getrlimit failed, assume it's fine
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion src/util/threadnames.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ static void SetInternalName(std::string name) { }

void util::ThreadRename(std::string&& name)
{
SetThreadName(("defi-" + name).c_str());
SetThreadName(("defid-" + name).c_str());
SetInternalName(std::move(name));
}

0 comments on commit a2cf10b

Please sign in to comment.