Files
kotlin-fork/kotlin-native/backend.native/tests/interop/leakMemoryWithRunningThread/leakMemory.cpp
T
2020-12-14 15:25:37 +01:00

16 lines
298 B
C++

#include "leakMemory.h"
#include <atomic>
#include <thread>
extern "C" void test_RunInNewThread(void (*f)()) {
std::atomic<bool> haveRun(false);
std::thread t([f, &haveRun]() {
f();
haveRun = true;
while (true) {}
});
t.detach();
while (!haveRun) {}
}