MCPcopy Create free account
hub / github.com/apache/brpc / run

Method run

tools/trackme_server/trackme_server.cpp:148–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146}
147
148void BugsLoader::run() {
149 // Check status of _bugs_files periodically.
150 butil::FileWatcher fw;
151 if (fw.init(_bugs_file.c_str()) < 0) {
152 LOG(ERROR) << "Fail to init FileWatcher on `" << _bugs_file << "'";
153 return;
154 }
155 while (!_stop) {
156 load_bugs();
157 while (!_stop) {
158 butil::FileWatcher::Change change = fw.check_and_consume();
159 if (change > 0) {
160 break;
161 }
162 if (change < 0) {
163 LOG(ERROR) << "`" << _bugs_file << "' was deleted";
164 }
165 sleep(1);
166 }
167 }
168
169}
170
171void BugsLoader::load_bugs() {
172 butil::ScopedFILE fp(fopen(_bugs_file.c_str(), "r"));

Callers 1

run_thisMethod · 0.45

Calls 3

check_and_consumeMethod · 0.80
initMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected