Fix interop_cleaners_second_thread

This commit is contained in:
Alexander Shabalin
2020-10-23 14:29:33 +03:00
committed by Stanislav Erokhin
parent d0cd2f2f8d
commit cbdd6fd245
2 changed files with 5 additions and 0 deletions
@@ -6,6 +6,8 @@
import kotlin.native.internal.*
fun ensureInitialized() {}
fun createCleaner() {
createCleaner(42) {
println(it)
@@ -8,6 +8,9 @@
#include <thread>
int main() {
// Make sure runtime is initialized on the main thread, so that secondary thread death
// doesn't destroy the entire runtime.
testlib_symbols()->kotlin.root.ensureInitialized();
std::thread t([]() { testlib_symbols()->kotlin.root.createCleaner(); });
t.join();
testlib_symbols()->kotlin.root.performGC();