[gambit-list] stop top
Marc Feeley
feeley at iro.umontreal.ca
Thu Sep 17 16:53:51 EDT 2009
On 17-Sep-09, at 4:04 PM, David St-Hilaire wrote:
> Marc Feeley wrote:
>>
>> On 17-Sep-09, at 3:38 PM, David St-Hilaire wrote:
>>
>>>> How about ctrl-C?
>>>>
>>>> Marc
>>>
>>> Well I guess it works in the terminal, but not in an emacs
>>> buffer... :'(
>>
>> In emacs it is ctrl-C ctrl-C .
>>
>> Marc
>
> It seems to work if there is only the primordial thread running, but
> after
> having run:
>
>
> (let loop ((i 0))
> (if (< i 30)
> (begin (thread-start!
> (make-thread
> (lambda () (let loop2 () (thread-sleep! 0.1)
> (loop2)))))
> (loop (+ i 1)))))
>
> for example, C-c C-c will not stop top from printing out the threads
> running.
> Well anyways, thats whats happening on my laptop.
A "user-interrupt", which is generated when ctrl-C is typed at the
console, will interrupt the currently running thread. If you have
many threads, then there is no guarantee that the one that gets
interrupted is the one running "top".
It is possible to program something different by redefining the
interrupt handler for "user-interrupt". For example this code will
change the user interrupt handler so that the processing of the user
interrupt is done in the primordial thread regardless of which thread
was running at the moment ctrl-C was typed:
(current-user-interrupt-handler
(lambda ()
(thread-interrupt! #1 ##default-user-interrupt-handler)))
If you always run top from the primordial thread, then you should be
good.
Marc
More information about the Gambit-list
mailing list