4d346d3735
Including * Support thread state switching in codegen * Introduce and use GCUnsafeCall annotation * Switch thread state in C++ runtime code Also * Register current thread in Mark&Sweep tests * Store MemoryState in Worker instance * Set worker tid in WorkerInit
20 lines
491 B
C++
20 lines
491 B
C++
#include <thread>
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
|
|
// Implemented in the runtime for test purposes.
|
|
extern "C" bool Kotlin_Debugging_isThreadStateNative();
|
|
|
|
extern "C" void assertNativeThreadState() {
|
|
if (!Kotlin_Debugging_isThreadStateNative()) {
|
|
printf("Incorrect thread state. Expected native thread state.");
|
|
abort();
|
|
}
|
|
}
|
|
|
|
extern "C" void runInNewThread(void(*callback)(void)) {
|
|
std::thread t([callback]() {
|
|
callback();
|
|
});
|
|
t.join();
|
|
} |