Skip to content

Commit

Permalink
Feedback: Change from unreachable to abort.
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacault committed Jan 22, 2025
1 parent 446e180 commit fc8431d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions source/common/ur_singleton.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include <mutex>
#include <unordered_map>

#include "logger/ur_logger.hpp"

//////////////////////////////////////////////////////////////////////////
/// a abstract factory for creation of singleton objects
template <typename singleton_tn, typename key_tn> class singleton_factory_t {
Expand Down Expand Up @@ -79,7 +81,8 @@ template <typename singleton_tn, typename key_tn> class singleton_factory_t {
if (auto iter = map.find(getKey(key)); iter != map.end()) {
iter->second.ref_count++;
} else {
__builtin_unreachable();
logger::error("Invalid singleton key. Aborting.");
std::abort();
}
}

Expand All @@ -94,7 +97,8 @@ template <typename singleton_tn, typename key_tn> class singleton_factory_t {
iter->second.ref_count--;
}
} else {
__builtin_unreachable();
logger::error("Invalid singleton key. Aborting.");
std::abort();
}
}

Expand Down

0 comments on commit fc8431d

Please sign in to comment.