Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't kill process when embedded #135

Merged
merged 1 commit into from
Mar 2, 2021
Merged

Conversation

fmagin
Copy link
Contributor

@fmagin fmagin commented Mar 2, 2021

This tries is intended as a fix for GhidraJupyter/ghidra-jupyter-kotlin#2

Using exitProcess(0) will terminate the entire process, but if the kernel is used as a library and embedded in another application, i.e. process this will be terminated too. Instead the code that handles the ShutdownRequest now has a somewhat inelegant check if the kernel is embedded and will instead just throw an InterruptedException which is caught in the controlThread loop and leads to the controlThread interrupting the mainThread so they both terminate and the entire kernel terminates.

Because I don't know why exitProcess(0) was used in the first place this will only happen if the kernel is embedded for now, but if this also works for the regular usage this could be simplified to just always throwing an InterruptedException

@ileasile ileasile force-pushed the embedded_shutdown branch from c6bf281 to 57ba019 Compare March 2, 2021 18:09
@ileasile ileasile merged commit ea1382a into Kotlin:master Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants