Hey! Is it expected that multithreading doesn’t work in scratch files? I just tried to run some Kotlin code that creates threads inside the scratch file and it doesn’t seem to work. It doesn’t crash but I can’t see the output.
j
Jakub Pi
05/20/2020, 3:00 PM
I've seen a problem where code that returns a value that you ignore doesn't get executed. e.g. side effects are ignored.. So might not be thread specific
a
arekolek
05/20/2020, 3:03 PM
Maybe you just need to wait for all the threads to finish?
arekolek
05/20/2020, 3:03 PM
normally if you reach the end of scratch file the execution will be stopped
j
Jakub Pi
05/20/2020, 3:25 PM
Yes, you should have a join or equivalent at the end so the main thread doesn't terminate while children are doing work
m
mzgreen
05/20/2020, 4:27 PM
Oh that makes sense. I haven't thought of that. Will try it, thanks!