[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: scm_shell in C-Thread - Quit vs. Terminal Corruption
From: |
Neil Jerram |
Subject: |
Re: scm_shell in C-Thread - Quit vs. Terminal Corruption |
Date: |
Sun, 18 Oct 2009 16:05:57 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
address@hidden writes:
> Hej linas,
>
> thanks for your reply.
>
>> > application and guile). When I enter
>> > (quit)
>> > in the terminal scm_shell calls exit(), which does not care much for my
>> > application cleanup.
>> wouldn't atexit() solve this problem?
> Yes, you're right. atexit() would solve this problem. Didn't really
> think about that before... hm :)
> Sadly, the otherway around is much more common (pressing ESC in the
> application window, thus terminating the actual application thread).
Calling scm_shell() with no args means just that that thread will run
`(top-repl)' - whose definition you can see in boot-9.scm. In other
words you could say that the default args are like `-c (top-repl)'.
`(quit)' means (throw 'quit ...), and the (top-repl) code handles this
by exiting its internal loop. Then scm_shell() calls exit().
So, if you want something else to happen after `(quit)', such as waiting
for other threads to terminate and clean up, you just need to put code
for that in a procedure named, e.g. `wait-for-cleanup', and then call
scm_shell() with args `-c (begin (top-repl) (wait-for-cleanup)'.
(All in theory anyway, I'm afraid I haven't tested this!)
Neil