本文整理汇总了C++中Controller::call_id方法的典型用法代码示例。如果您正苦于以下问题:C++ Controller::call_id方法的具体用法?C++ Controller::call_id怎么用?C++ Controller::call_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Controller
的用法示例。
在下文中一共展示了Controller::call_id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Clear
void Sender::Clear() {
if (_main_cntl == NULL) {
return;
}
delete _alloc_resources[1].response;
delete _alloc_resources[1].sub_done;
_alloc_resources[1] = Resource();
const CallId cid = _main_cntl->call_id();
_main_cntl = NULL;
if (_user_done) {
_user_done->Run();
}
bthread_id_unlock_and_destroy(cid);
}
示例2: Run
void Sender::Run() {
_finished = true;
if (_nfree != _nalloc) {
const int saved_nalloc = _nalloc;
int error = (_main_cntl->ErrorCode() == ERPCTIMEDOUT ? ERPCTIMEDOUT : ECANCELED);
CallId ids[_nalloc];
for (int i = 0; i < _nalloc; ++i) {
ids[i] = _alloc_resources[i].sub_done->_cntl.call_id();
}
CallId cid = _main_cntl->call_id();
CHECK_EQ(0, bthread_id_unlock(cid));
for (int i = 0; i < saved_nalloc; ++i) {
bthread_id_error(ids[i], error);
}
} else {
Clear();
}
}
示例3: CallMethod
void SelectiveChannel::CallMethod(
const google::protobuf::MethodDescriptor* method,
google::protobuf::RpcController* controller_base,
const google::protobuf::Message* request,
google::protobuf::Message* response,
google::protobuf::Closure* user_done) {
Controller* cntl = static_cast<Controller*>(controller_base);
if (!initialized()) {
cntl->SetFailed(EINVAL, "SelectiveChannel=%p is not initialized yet",
this);
}
schan::Sender* sndr = new schan::Sender(cntl, request, response, user_done);
cntl->_sender = sndr;
cntl->add_flag(Controller::FLAGS_DESTROY_CID_IN_DONE);
const CallId cid = cntl->call_id();
_chan.CallMethod(method, cntl, request, response, sndr);
if (user_done == NULL) {
Join(cid);
cntl->OnRPCEnd(butil::gettimeofday_us());
}
}