Skip to content

Commit

Permalink
Turning another assert into an exception
Browse files Browse the repository at this point in the history
- flyby: adding unlocks of mutexes before exceptions are thrown
  • Loading branch information
hkaiser committed May 16, 2017
1 parent cfb9f6b commit d2f333b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/runtime/agas/addressing_service.cpp
Expand Up @@ -316,7 +316,15 @@ bool addressing_service::register_locality(
prefix
, endpoints
));
HPX_ASSERT(res.second);

if (!res.second)
{
l.unlock();
HPX_THROWS_IF(ec, bad_parameter,
"addressing_service::register_locality",
"locality insertion failed because of a duplicate");
return false;
}
}

return true;
Expand Down Expand Up @@ -380,6 +388,8 @@ parcelset::endpoints_type const & addressing_service::resolve_locality(
std::stringstream strm;
strm << "couldn't resolve the given target locality ("
<< gid << ")";
l.unlock();

HPX_THROWS_IF(ec, bad_parameter,
"addressing_service::resolve_locality",
strm.str());
Expand Down Expand Up @@ -1858,6 +1868,7 @@ void addressing_service::update_cache_entry(
if (!gva_cache_->get_entry(key, idbase, e))
{
// This is impossible under sane conditions.
l.unlock();
HPX_THROWS_IF(ec, invalid_data
, "addressing_service::update_cache_entry"
, "data corruption or lock error occurred in cache");
Expand Down

0 comments on commit d2f333b

Please sign in to comment.