diff --git a/runtime/src/main/cpp/Porting.cpp b/runtime/src/main/cpp/Porting.cpp index e6359ea948e..55f4f2b8ee6 100644 --- a/runtime/src/main/cpp/Porting.cpp +++ b/runtime/src/main/cpp/Porting.cpp @@ -127,7 +127,7 @@ void onThreadExit(void (*destructor)()) { #ifdef KONAN_WASM // No way to do that. #else - ::atexit(destructor); +#error "How to do onThreadExit()?" #endif #else // !KONAN_NO_THREADS // We cannot use pthread_cleanup_push() as it is lexical scope bound. diff --git a/runtime/src/main/cpp/Runtime.cpp b/runtime/src/main/cpp/Runtime.cpp index 73e98353545..a64ea2bf847 100644 --- a/runtime/src/main/cpp/Runtime.cpp +++ b/runtime/src/main/cpp/Runtime.cpp @@ -82,15 +82,6 @@ void Kotlin_initRuntimeIfNeeded() { runtimeState = initRuntime(); // Register runtime deinit function at thread cleanup. konan::onThreadExit(Kotlin_deinitRuntimeIfNeeded); -#ifndef KONAN_WASM - // `onThreadExit` doesn't work on main thread, use `atexit`: - - static bool deinitScheduledAtexit = false; - if (!deinitScheduledAtexit) { - deinitScheduledAtexit = true; // Having data race is OK here. - ::atexit(Kotlin_deinitRuntimeIfNeeded); - } -#endif } }