Tests on migrating main thread and memory leaks with interop (#4494)

This commit is contained in:
Alexander Shabalin
2020-11-03 15:49:27 +03:00
committed by Stanislav Erokhin
parent 4c9bbe54d4
commit fc7cf48798
5 changed files with 87 additions and 0 deletions
@@ -0,0 +1,26 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
#include "testlib_api.h"
#include <cassert>
#include <thread>
int main() {
std::thread main1([]() {
assert(testlib_symbols()->kotlin.root.readFromA() == 0);
testlib_symbols()->kotlin.root.writeToA(1);
assert(testlib_symbols()->kotlin.root.readFromA() == 1);
});
main1.join();
std::thread main2([]() {
// Globals were reinitialized.
assert(testlib_symbols()->kotlin.root.readFromA() == 0);
});
main2.join();
return 0;
}