mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 15:51:01 +00:00
[K/N][Runtime] Separate thread registering and making it 'Runnable'
The new GC will require threads to suspend right after registering if Stop-The-World is requested. This patch changes the initial thread state to kNative and adds a separate state switch right after thread registering. This switch suspends if it is necessary.
This commit is contained in:
@@ -243,6 +243,10 @@ class {
|
||||
|
||||
//! Process exception hook (if any) or just printStackTrace + write crash log
|
||||
void processUnhandledKotlinException(KRef throwable) {
|
||||
// Use the reentrant switch because both states are possible here:
|
||||
// - runnable, if the exception occured in a pure Kotlin thread (except initialization of globals).
|
||||
// - native, if the throwing code was called from ObjC/Swift or if the exception occured during initialization of globals.
|
||||
kotlin::ThreadStateGuard guard(kotlin::ThreadState::kRunnable, /* reentrant = */ true);
|
||||
OnUnhandledException(throwable);
|
||||
#if KONAN_REPORT_BACKTRACE_TO_IOS_CRASH_LOG
|
||||
ReportBacktraceToIosCrashLog(throwable);
|
||||
|
||||
Reference in New Issue
Block a user