Skip to content
This repository has been archived by the owner on Aug 10, 2021. It is now read-only.

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Ivanov committed Jun 19, 2020
1 parent 78164f1 commit ef2e621
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions runtime/src/main/cpp/Exceptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ RUNTIME_NORETURN void TerminateWithUnhandledException(KRef throwable) {
namespace {
class TerminateHandler {

// In fact, it's safe to call my_handler directly from outside: it will do the job and then invoke original handler,
// even if it has not been initialized yet. So one may want to make it public and/or not the class member
// In fact, it's safe to call my_handler directly from outside: it will do the job and then invoke original handler,
// even if it has not been initialized yet. So one may want to make it public and/or not the class member
RUNTIME_NORETURN static void kotlinHandler() {
concurrentTerminateWrapper([]() {
if (auto currentException = std::current_exception()) {
Expand Down Expand Up @@ -323,28 +323,27 @@ class TerminateHandler {
return singleton;
}

// Copy, move and assign would be safe, but not much useful, so let's delete all (rule of 5)
TerminateHandler(const TerminateHandler&) = delete;
TerminateHandler(TerminateHandler&&) = delete;
TerminateHandler& operator=(const TerminateHandler&) = delete;
TerminateHandler& operator=(TerminateHandler&&) = delete;
// Dtor might be in use to restore original handler. However, consequent install
// will not reconstruct handler anyway, so let's keep dtor deleted to avoid confusion.
~TerminateHandler() = delete;
// Copy, move and assign would be safe, but not much useful, so let's delete all (rule of 5)
TerminateHandler(const TerminateHandler&) = delete;
TerminateHandler(TerminateHandler&&) = delete;
TerminateHandler& operator=(const TerminateHandler&) = delete;
TerminateHandler& operator=(TerminateHandler&&) = delete;
// Dtor might be in use to restore original handler. However, consequent install
// will not reconstruct handler anyway, so let's keep dtor deleted to avoid confusion.
~TerminateHandler() = delete;
public:
/// First call will do the job, all consecuent will do nothing.
static void install() {
instance(); // Use side effect of warming up
}
/// First call will do the job, all consecuent will do nothing.
static void install() {
instance(); // Use side effect of warming up
}
};
} // anon namespace

// Use one public funuction to limit access to the class declaration
void SetKonanTerminateHandler() {
TerminateHandler::install();
TerminateHandler::install();
}


#else // KONAN_OBJC_INTEROP

void SetKonanTerminateHandler() {
Expand Down

0 comments on commit ef2e621

Please sign in to comment.