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

Function bthread_id_error2_verbose

src/bthread/id.cpp:709–742  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

707}
708
709int bthread_id_error2_verbose(bthread_id_t id, int error_code,
710 const std::string& error_text,
711 const char *location) {
712 bthread::Id* const meta = address_resource(bthread::get_slot(id));
713 if (!meta) {
714 return EINVAL;
715 }
716 const uint32_t id_ver = bthread::get_version(id);
717 uint32_t* butex = meta->butex;
718 meta->mutex.lock();
719 if (!meta->has_version(id_ver)) {
720 meta->mutex.unlock();
721 return EINVAL;
722 }
723 if (*butex == meta->first_ver) {
724 *butex = meta->locked_ver;
725 meta->lock_location = location;
726 meta->mutex.unlock();
727 if (meta->on_error) {
728 return meta->on_error(id, meta->data, error_code);
729 } else {
730 return meta->on_error2(id, meta->data, error_code, error_text);
731 }
732 } else {
733 bthread::PendingError e;
734 e.id = id;
735 e.error_code = error_code;
736 e.error_text = error_text;
737 e.location = location;
738 meta->pending_q.push(e);
739 meta->mutex.unlock();
740 return 0;
741 }
742}
743
744int bthread_id_list_reset2(bthread_id_list_t* list,
745 int error_code,

Callers 2

operator()Method · 0.85
bthread_id_error_verboseFunction · 0.85

Calls 6

get_slotFunction · 0.70
get_versionFunction · 0.70
address_resourceFunction · 0.50
lockMethod · 0.45
unlockMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected