Skip to content

Commit

Permalink
usdt: Have Context::addsem_probe() nop if pid not specified
Browse files Browse the repository at this point in the history
This makes bcc_usdt_addsem*() more consistent with the bcc_usdt_enable*()
interface where if a USDT::Context was not constructed with a pid the
semaphore enablement nops.
  • Loading branch information
danobi authored and yonghong-song committed Jun 6, 2020
1 parent 126054e commit 0bcf238
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/cc/usdt/usdt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,12 @@ bool Context::addsem_probe(const std::string &provider_name,
int16_t val) {
Probe *found_probe = get_checked(provider_name, probe_name);

if (found_probe != nullptr)
return found_probe->add_to_semaphore(val);
if (found_probe != nullptr) {
if (found_probe->need_enable())
return found_probe->add_to_semaphore(val);

return true;
}

return false;
}
Expand Down

0 comments on commit 0bcf238

Please sign in to comment.