unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.uklinux.net>
To: kai.selgrad@web.de
Cc: guile-user@gnu.org
Subject: Re: scm_shell in C-Thread - Quit vs. Terminal Corruption
Date: Sun, 18 Oct 2009 16:05:57 +0100	[thread overview]
Message-ID: <87iqec7ne2.fsf@ossau.uklinux.net> (raw)
In-Reply-To: <20091017173618.GA5441@shoikan> (kai selgrad's message of "Sat, 17 Oct 2009 19:36:18 +0200")

kai.selgrad@web.de 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





  reply	other threads:[~2009-10-18 15:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-16 19:09 scm_shell in C-Thread - Quit vs. Terminal Corruption vimml
2009-10-17  2:42 ` Linas Vepstas
2009-10-17 17:36   ` kai.selgrad
2009-10-18 15:05     ` Neil Jerram [this message]
2009-10-18 15:48       ` kai.selgrad
2009-10-17  2:49 ` Linas Vepstas
2009-10-17 12:44   ` Ludovic Courtès
2009-10-17 17:43     ` vimml
2009-10-17 17:47   ` vimml
2009-10-17 12:52 ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87iqec7ne2.fsf@ossau.uklinux.net \
    --to=neil@ossau.uklinux.net \
    --cc=guile-user@gnu.org \
    --cc=kai.selgrad@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).