Closed tinmarino closed 4 years ago
I asked a question on stackoverflow. Answer : no way to kill a thread (Bduggan told me a week earlier but I like to double check).
It is overkill to fork for each user request (<Enter>
) I guess.
Python is treating the SIGINT
as KeyboardInterrupt
exception that the main thread sends to a registered thread. On Linux, the main thread is receiving this signal so it is clean.
Long Journey => Be sure to -Ofun
(jnthn)
longjmp
are present in the MoarVm (Dig deeper is the language stack)try
catch
is THE solution. The exception must come from a side channel (see how other kernel handle the situation)Hard Challenge => If you keep on until success, you will succeed before you stop
I see the same behavior that you do. To me it's strange that ctrl-c in the console client even sends a SIGINT to the kernel; it seems like this should behave the same way that clicking 'interrupt' in the web client would (send a shutdown request to the kernel). I would be okay with just treating ctrl-c as a shutdown+restart request. It's not ideal, but it's better than the current behavior. Also as Jonathan pointed out there's no good way to deal with typing ctrl-c when the console code is starting threads other than hooking into the scheduler...and since this is raku, what if the console code is modifying $*SCHEDULER
:-)
It is too hard, plus the same issue appears in rakudo REPL. So ... I admit I .... abandon !
I opened #84 which makes the experience a little better -- I think it's a reasonable solution -- and I haven't seen any negative effects of doing the eval on another thread.
On a Slow IO, pressing cltr-c should be handled and interupt the IO but not the full kernel. The roadmap is to copy IPython implementation:
In [1]: /home2/tourneboeuf/.local/lib/python3.7/site-packages/jupyter_console/ptshell.py:713: UserWarning: The kernel did not respond to an is_complete_request. Setting
use_kernel_is _complete
to False. warn('The kernel did not respond to an is_complete_request. 'In [3]: sleep(10)
^C--------------------------------------------------------------------------- KeyboardInterrupt Traceback (most recent call last)