MCPcopy Create free account
hub / github.com/apache/brpc / operator()

Method operator()

src/bvar/default_variables.cpp:385–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

383class FdReader {
384public:
385 bool operator()(int* stat) const {
386 if (s_ever_reached_fd_scan_limit.load(butil::memory_order_relaxed)) {
387 // Never update the count again.
388 return false;
389 }
390 const int count = get_fd_count(MAX_FD_SCAN_COUNT);
391 if (count < 0) {
392 return false;
393 }
394 if (count == MAX_FD_SCAN_COUNT - 2
395 && s_ever_reached_fd_scan_limit.exchange(
396 true, butil::memory_order_relaxed) == false) {
397 // Rename the bvar to notify user.
398 g_fd_num.hide();
399 g_fd_num.expose("process_fd_num_too_many");
400 }
401 *stat = count;
402 return true;
403 }
404};
405
406static int print_fd_count(void*) {

Callers

nothing calls this directly

Calls 5

get_fd_countFunction · 0.85
loadMethod · 0.45
exchangeMethod · 0.45
hideMethod · 0.45
exposeMethod · 0.45

Tested by

no test coverage detected