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

Method call_id

src/brpc/controller.cpp:1336–1354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1334}
1335
1336CallId Controller::call_id() {
1337 butil::atomic<uint64_t>* target =
1338 (butil::atomic<uint64_t>*)&_correlation_id.value;
1339 uint64_t loaded = target->load(butil::memory_order_relaxed);
1340 if (loaded) {
1341 const CallId id = { loaded };
1342 return id;
1343 }
1344 // Optimistic locking.
1345 CallId cid = { 0 };
1346 // The range of this id will be reset in Channel::CallMethod
1347 CHECK_EQ(0, bthread_id_create2(&cid, this, HandleSocketFailed));
1348 if (!target->compare_exchange_strong(loaded, cid.value,
1349 butil::memory_order_relaxed)) {
1350 bthread_id_cancel(cid);
1351 cid.value = loaded;
1352 }
1353 return cid;
1354}
1355
1356void Controller::SaveClientSettings(ClientSettings* s) const {
1357 s->timeout_ms = _timeout_ms;

Callers 15

mainFunction · 0.80
sync_clientMethod · 0.80
TEST_FFunction · 0.80
TEST_FFunction · 0.80
TEST_FFunction · 0.80
TestSofaCompressMethod · 0.80
TEST_FFunction · 0.80
CallMethodMethod · 0.80

Calls 4

bthread_id_create2Function · 0.85
bthread_id_cancelFunction · 0.85
loadMethod · 0.45

Tested by 15

TEST_FFunction · 0.64
TEST_FFunction · 0.64
TEST_FFunction · 0.64
TestSofaCompressMethod · 0.64
TEST_FFunction · 0.64
CallMethodMethod · 0.64