Skip to content

Commit

Permalink
Move get_failure_handler to detail
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-rifkin committed Dec 22, 2024
1 parent 3849ce1 commit ea0c1a9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/assert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,19 +448,21 @@ namespace libassert {
}
}

static auto& get_failure_handler() {
static std::atomic handler = default_failure_handler;
return handler;
namespace detail {
auto& get_failure_handler() {
static std::atomic handler = default_failure_handler;
return handler;
}
}

LIBASSERT_ATTR_COLD LIBASSERT_EXPORT
void set_failure_handler(void (*handler)(const assertion_info&)) {
get_failure_handler() = handler;
detail::get_failure_handler() = handler;
}

namespace detail {
LIBASSERT_ATTR_COLD LIBASSERT_EXPORT void fail(const assertion_info& info) {
get_failure_handler().load()(info);
detail::get_failure_handler().load()(info);
}
}

Expand Down

0 comments on commit ea0c1a9

Please sign in to comment.