Patrick
12/30/2019, 9:30 AMMarc Reichelt
12/30/2019, 9:53 AMsignal
method you can define a sigint handler, like described here: https://www.tutorialspoint.com/cplusplus/cpp_signal_handling.htmMarc Reichelt
12/30/2019, 9:55 AMsignal
in your Kotlin Native project, IntelliJ will suggest you import platform.posix.signal
(SIGINT, exit, etc. are also there):Marc Reichelt
12/30/2019, 9:55 AMMarc Reichelt
12/30/2019, 9:56 AMMarc Reichelt
12/30/2019, 9:57 AMMarc Reichelt
12/30/2019, 9:57 AMMarc Reichelt
12/30/2019, 10:00 AMkotlinc-native sigint.kt -o sigint
and run it with ./sigint.kexe
- this will run forever, unless we send SIGTERM via: killall -SIGINT sigint.kexe
Then the handler function will be called 🙂Patrick
12/30/2019, 11:48 AMPatrick
12/30/2019, 11:56 AMMarc Reichelt
12/30/2019, 4:37 PMsignal
method - but how the function itself is implemented shouldn’t matter.Marc Reichelt
12/30/2019, 4:38 PMPatrick
12/30/2019, 5:00 PMPatrick
01/02/2020, 2:12 PMDominaezzz
01/02/2020, 2:15 PMPatrick
01/02/2020, 2:17 PMDominaezzz
01/02/2020, 2:17 PMstaticCFunction { MyObject.handleSigint(....) }
Explicitly specifying the object class and doing it in a lambda (not a method reference).Patrick
01/02/2020, 2:21 PMPatrick
01/02/2020, 2:22 PMDominaezzz
01/02/2020, 2:24 PMprintln
and stuff?Patrick
01/02/2020, 2:27 PMPatrick
01/03/2020, 1:22 PMPatrick
01/03/2020, 1:22 PMPatrick
01/06/2020, 9:06 AMkotlin.native.initRuntimeIfNeeded()
if your callback is called on another thread. Could that be the issue?Dominaezzz
01/06/2020, 10:31 AMPatrick
01/06/2020, 10:32 AMDominaezzz
01/06/2020, 10:33 AMPatrick
01/06/2020, 10:38 AMPatrick
01/06/2020, 10:39 AMDominaezzz
01/06/2020, 10:42 AMPatrick
01/06/2020, 10:43 AM